[XeTeX] Re: [MacTeX] XeTeX

Ross Moore ross at ics.mq.edu.au
Sun Apr 11 16:05:29 CEST 2004


Hi Bruno, Gerben, and others


On 10/04/2004, at 8:03 PM, Bruno Voisin wrote:

> More on XeTeX: having installed it for testing yesterday, I'm worried  
> now
> that there is no straightforward way to uninstall it, and that by being
> there it might (i) perturb the normal working of gwTeX and (ii) not
> survive its future updates.
> Looking at the postflight file inside XeTeX.pkg, which contains:
>
>> # now put the files where we really expect to find them
>>
>> mv /tmp/xetex-install/bin/*   ${bindir}
>> mv /tmp/xetex-install/web2c/* ${web2cdir}
>> mv /tmp/xetex-install/otf/*   ${otfdir}

The values ${bindir}, ${web2cdir}, ${otfdir}  are (supposed to be) set
within the preflight script, to be within the  texmf.local  tree.
Thus they should survive updates.

The non-executable files themselves have extensions:
   .xfmt   (formats)
   .otf    (fonts)
which are currently not used by other applications...

   ...except that maybe .otf fonts are starting to be used by
Omega, etc. In this case, these are probably consistent; not sure.


>
> and later
>
>> # try to edit texmf.cnf to create an OTFFONTS entry
>> # if there doesn't seem to be one already present
>>
>> if [ -e /Library/teTeX/share/texmf/web2c/texmf.cnf ]; then
>> 	echo "attempting to edit texmf.cnf" >> /tmp/xetex-install/log
>> 	/usr/bin/perl -i.bak -e '$/=undef; $_=<>; s@(\nT1FONTS.*\n)@\1\n%
>> 	OpenType fonts\nOTFFONTS = .;\$TEXMF/fonts/otf//\n@ unless
>> 	m@\nOTFFONTS@; print' /Library/teTeX/share/texmf/web2c/texmf.cnf> fi

Edits to the  texmf.cnf  file may not survive updates.
Gerben, what do you do about this ?



>
> it seems that:
>
> - binaries are installed inside  
> /usr/local/teTeX/bin/powerpc-apple-darwin6.8:
>
> -rwxr-xr-x  1 brunovoi  staff   515460  7 Apr 16:51 xdv2pdf
> lrwxr-xr-x  1 brunovoi  staff        5  9 Apr 23:13 xeinitex -> xetex
> -rwxr-xr-x  1 brunovoi  staff  1060392  7 Apr 16:51 xetex
> lrwxr-xr-x  1 brunovoi  staff        5  9 Apr 23:13 xevirtex -> xetex

It's not hard to find and remove these.
But why would you ever want to ? ...

> - formats are created inside /usr/local/teTeX/share/texmf.local/web2c:
>
> lrwxr-xr-x  1 brunovoi  staff       10  9 Apr 23:13 plain.xfmt ->  
> xetex.xfmt
> -rw-r--r--  1 brunovoi  staff    28726  7 Apr 16:51 xetex.pool
> -rw-r--r--  1 brunovoi  staff   995986  7 Apr 16:51 xetex.xfmt

  ... once installed, there's no need to uninstall.
Their presence cannot affect the running of other TeX programs.


>
> - OTF versions of the CM and AMS fonts are put inside
> /usr/local/teTeX/share/texmf.local/fonts/otf:
> -rw-r--r--  1 brunovoi  staff  18436  2 May  2003 cmb10.otf
> -rw-r--r--  1 brunovoi  staff  21904  2 May  2003 cmbsy10.otf
> -rw-r--r--  1 brunovoi  staff  22652  2 May  2003 cmbsy5.otf
> [...]
>
> - an OTFFONTS entry is added to  
> /usr/local/teTeX/share/texmf/web2c/texmf.cnf:
>
> % OpenType fonts
> OTFFONTS = .;$TEXMF/fonts/otf//

This seems like a sensible way to organise these files.


>
> Fot those here who know better the inner workings of gwTeX than me, can
> this lead to problems (i) or (ii) above?

I don't think this is much of an issue at present.
It would only become one if there were different ways to handle
OpenType fonts.


> All in all my impression is that XeTeX is a major advance for us
> afficionados of TeX on the Mac, this is an impressive piece of work,  
> great
> attention has been put to build upon existing tools, but I have  
> concerns
> about:
> - Compatibility: What are the specificiations of XDV format? Is it
> compatible with standard extensions to TeX? Can it accommodate to  
> LaTeX (I
> assume yes)? hyperref (I assume not)?

Creating a driver for use with graphics probably wouldn't be too hard.
But supporting color and hyperlinks and other driver-dependent effects
would require knowing the full capabilities of  xdv2pdf .


> - Ease of use (but this is normal for prerelease software): No easy  
> way is
> provided for compiling a LaTeX format and making it work with TeXShop,  
> for
> example. (As I write this I see a message coming in from Ross telling  
> this
> can be done, I'll look at it later.)

Compiling a LaTeX format is easy enough:
       xeinitex  latex.ltx    produces   latex.xfmt
which can be renamed to  xelatex.xfmt  and moved to a standard location.

But it's better to do:

       xetex -ini -jobname=xelatex latex.ltx

then move it to:

     /usr/local/teTeX/share/texmf.local/web2c/xelatex.xfmt


Next, create a command  xelatex  similar to  pdflatex ;
viz.

[glenlivet:] rossmoor% more `which pdflatex`
#!/bin/sh
test -f "`kpsewhich pdflatex.fmt`" || fmtutil --byfmt pdflatex
exec pdftex -fmt=pdflatex -progname=pdflatex "$@"


[glenlivet:~/Sources/XeTeX/XeTeX samples] rossmoor% more `which xelatex`
#!/bin/sh
test -f "`kpsewhich -format=fmt -progname=xetex xelatex.xfmt`" ||  
fmtutil --byfmt xelatex
exec xetex -xfmt=xelatex -progname=xelatex "$@"


The extra options:  -format=fmt -progname=xetex
are appropriate, since  kpathsea  was not built with the knowledge
of  .xfmt  as the extension for format files for  xetex .
These options provide that missing knowledge and allow  kpsewhich
to efficiently find the desired format file.


Then add lines to  texmf.cnf :

% XeTeX.
TEXINPUTS.xelatex   =     .;$TEXMF/{etex,tex}/{latex,generic,}//
TEXINPUTS.xetex     =     .;$TEXMF/{etex,tex}/{plain,generic,}//

TEXFORMATS.xelatex  =     .;$TEXMFLOCAL/web2c


Now you can configure TeXShop's `Personal script' to use
   xetex  and  xelatex .



> - Coordination: It would be more productive, I think, and better for  
> the
> popularity for TeX on the Mac at large, that the design of XeTeX and in
> particular of the XDV format be coordinated with developers of existing
> implementations and variants of TeX (Gerben, Hans, and the other
> knowledgeable people on this list), such that it is  
> backwards-compatible
> with what exists already, and in particular won't break LaTeX and its  
> many
> available packages.

Yes. Currently there are some problems. See below.

> Ross: I have no difficulties compiling CM-test.tex. In case you're  
> using
> TeXShop, did you select UTF-8 encoding?

Sure did.
I'm still having difficulty with the CM fonts, and mathematics  
generally.

>
> Finally, I just realized that some information on XeTeX can be obtained
> simply by typing in Terminal:
> xetex -h

Yes; that's useful.
Unfortunately there is no similar help for  xdv2pdf .
In particular, it would be nice to be able to do some tracing
of  xdv2pdf  similar to what can be done with  dvips .

This is needed for me to explore further why the  CM-test  example
doesn't work for me.



I've encountered at least 3 definite (perhaps related) problems
using  xelatex .
Here they are


  1.  "Bad file descriptor"  messages

l.42 \begin{document}

?
fclose: Bad file descriptor
fclose: Bad file descriptor
fclose: Bad file descriptor
fclose: Bad file descriptor
fclose: Bad file descriptor
fclose: Bad file descriptor
(/usr/local/teTeX/texmf/tex/latex/amsfonts/umsa.fd)fclose: Bad file  
descriptor
fclose: Bad file descriptor

To get a better look at where these occur, use kpathsea-tracing:

   xelatex -kpathsea-debug=-1 -recorder PicFileLSample.ltx


This gives tracing messages, such as:

kdebug:search([umsb.fd.tex umsb.fd]) =>  
/usr/local/teTeX/texmf/tex/latex/amsfonts/umsb.fd
kdebug:fopen(/usr/local/teTeX/texmf/tex/latex/amsfonts/umsb.fd, rb) =>  
0xa0009978

(/usr/local/teTeX/texmf/tex/latex/amsfonts/umsb.fd)kdebug: 
fclose(0xa0009978) => 0
kdebug:fclose(0xa0009978) => -1
fclose: Bad file descriptor
kdebug:fclose(0xa0009978) => -1
fclose: Bad file descriptor

Here we see that umsb.fd was successfully opened, (reference:  
0xa0009978)
and closed after being read:  fclose(0xa0009978) => 0
However, there were 2 further attempts to close the same file,
resulting in the  "Bad file descriptor"  messages.

So far as I can tell, there are no adverse effects from this,
with respect to the typesetting and final PDF. It's possible that
so redundant coding has been left in the  xetex  source.


  2.  "Bad mathchar"

(/usr/local/teTeX/texmf/tex/latex/amslatex/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/teTeX/texmf/tex/latex/amslatex/amstext.sty
(/usr/local/teTeX/texmf/tex/latex/amslatex/amsgen.sty))
(/usr/local/teTeX/texmf/tex/latex/amslatex/amsbsy.sty)
(/usr/local/teTeX/texmf/tex/latex/amslatex/amsopn.sty)
! Bad mathchar (33685504).
<to be read again>
                    \relax
l.742 \mathchardef\std at minus\mathcode`\-\relax

There are several of these, coming from the  amsmath.sty  macros.
Every use of the TeX primitive \mathchardef  fails:
viz. (from amsmath.sty  lines 742--747)

\mathchardef\std at minus\mathcode`\-\relax
\mathchardef\std at equal\mathcode`\=\relax
\AtBeginDocument{%
   \mathchardef\std at minus\mathcode`\-\relax
   \mathchardef\std at equal\mathcode`\=\relax
}

Two failures occur in the preamble, then again during
the  \@begindocumenthook .



   3.  "Insufficient symbol fonts."


! Bad mathchar (67108904).
<to be read again>
                    \relax
l.44 \maketitle
                }
! Missing number, treated as zero.
<to be read again>
                    \relax
l.44 \maketitle
                }
?
! Missing number, treated as zero.
<to be read again>
                    }
l.44 \maketitle
                }
?
! Math formula deleted: Insufficient symbol fonts.
\endtabular ->\crcr \egroup \egroup $
                                      \egroup
l.44 \maketitle
                }
?

This error can be traced to usage of  \resetMathstrut@
defined as follows:

\def\resetMathstrut@{%
   \setbox\z@\hbox{%
     \mathchardef\@tempa\mathcode`\(\relax
     ^^^^^^^^^^^^
     \def\@tempb##1"##2##3{\the\textfont"##3\char"}%
     \expandafter\@tempb\meaning\@tempa \relax
   }%
   \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@
}
\addto at hook\every at math@size{\resetMathstrut@}



This is the same problem with \mathchardef as in #2.
However, since the usage is embedded in a macro,
which is called whenever the math-sizes are changed,
the effects are more extensive, and can be quite damaging.


In particular, the \maketitle macro has coding roughly
as follows:
    $ \begin{tabular} \Large .... \end{tabular} $

The \Large requires the strut-box to be reset, so the
failure of \mathchardef is encountered.
This leaves an incomplete math-definition, within the
$...$, so at the end we get that horrid:

   Math formula deleted: Insufficient symbol fonts.

As a result, the whole {tabular} environment gets
dropped. In the resulting PDF the \author information
doesn't show.


Here's another example:

! Bad mathchar (67108904).
<to be read again>
                    \relax
l.47 \bigbold Pictures in \XeLaTeX}

?
! Missing number, treated as zero.
<to be read again>
                    \relax
l.47 \bigbold Pictures in \XeLaTeX}

?
! Missing number, treated as zero.
<to be read again>
                    }
l.47 \bigbold Pictures in \XeLaTeX}

?

where  \XeLaTeX ---> X... \LaTeX
It's the small raised `A' in the LaTeX logo that fails,
due to math-sizes being checked when the font-size
is reduced.



This problem can be traced further, to an apparent
lack of support for the  \mathcode  values of characters
by XeTeX  ---  quite independent of LaTeX.


Try typesetting this 3-line file, using  tex  and  xetex .

\mathchardef\tmp\mathcode`\(
\show\tmp
\bye


With TeX you should get:

[glenlivet:] rossmoor% tex mtest
This is TeX, Version 3.14159 (Web2C 7.3.7x)
(./mtest
 > \tmp=\mathchar"4028.
l.2 \show\tmp

?
  )
No pages of output.


With XeTeX the result I get is:

[glenlivet:] rossmoor% xetex mtest
This is XeTeXk, Version 3.14159-2.1-0.3 (Web2C 7.5.2)
  %&-line parsing enabled.
entering extended mode
(./mtest
! Bad mathchar (67108904).
l.1 \mathchardef\tmp\mathcode`\(

?
 > \tmp=\mathchar"0.
l.2 \show\tmp

?
  )
No pages of output.


  ... a result that is quite unacceptable, and which
would kill quite a bit of mathematics typesetting.

So, would someone please verify this test.
It may be that there's something different about my
TeX installation which affects this.


Cheers

	Ross


>
> Bruno
>
>
> _______________________________________________
> MacTeX mailing list
> http://tug.org/mailman/listinfo/mactex
>
------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------

_______________________________________________
MacTeX mailing list
http://tug.org/mailman/listinfo/mactex



More information about the XeTeX mailing list