[OS X TeX] MacTeX inputs

Bruno Voisin bvoisin at mac.com
Mon Nov 13 09:48:50 EST 2006

Le 13 nov. 06 à 15:03, Louis S VanSlyck a écrit :

> One can use pen color by:
> \input color
> {\color{red} This line is red.}
> Or one can insert a picture by:
> \input graphicx
> \includegraphics[scale=0.5]{Logo}
> But the two inputs seem to be mutually exclusive.
> Whichever \input command appears first causes an error at the  
> second, and typeset fails.

Here the above works if you load graphicx.tex before color.tex.

This seems to be caused by the handling of the "@" character in  
miniltx.tex, graphicx.tex and color.tex, apparently deficient:  
miniltx.tex (called by graphicx.tex and color.tex) defines  
\makeatletter and \makeatother, then uses \makeatletter immediately  
but neglects to reset \makeatother before closing. There may be some  
reasoning behind this, but I fail to see it for now.

\makeatletter is the standard LaTeX way of making "@" behave as a  
letter, such that it can be used in command names, and \makeatother  
is what makes the opposite, i.e. prohibit "@" to appear in command  
names. The LaTeX format and the LaTeX packages start with  
\makeatletter, use "@" in their internal command names, then end up  
with \makeatother. In this way a LaTeX user won't be able to define  
commands with an "@" in their names, and hence won't be able to  
interfere inadvertently with the LaTeX internals.

However, miniltx.tex omits the final \makeatother. graphicx.tex is  
apparently meant to be called first, as it uses @ in a command name,  
immediately after calling miniltx.tex, and ends with \makeatother  
(or, equivalently, \resetatcatcode):

> \input miniltx
> \def\Gin at driver{dvips.def}
> \input graphicx.sty
> \resetatcatcode

color.tex, by contrast, does use \makeatletter immediately after  
calling miniltx.tex:

> \input miniltx
> \makeatletter
> \def\Gin at driver{dvips.def}
> \input color.sty
> \resetatcatcode

Hence it looks like graphicx.tex must be called before color.tex.

Actually I would advise to include the code from graphicx.tex and  
color.tex directly in your TeX input file, and to modify it so as to  
make it more efficient: nowadays TeX includes a way to determine  
automagically in which form it is called (pdfTeX, TeX + dvips, or  
XeTeX), such that you can simply write in your TeX input file:

\input miniltx
\input color.sty
\input graphicx.sty


\input miniltx
\input color.sty
\input graphicx.sty

and the appropriate driver file (pdftex.def, dvips.def or xetex.def)  
will be selected on-the-fly and the proper graphics file format  
(.pdf, .eps, .jpg, .tiff, etc.) selected as well. In modern TeX,  
there is no need to write \def\Gin at driver{[...].def} for selecting  
the driver file any longer.

Hope this helps,

Bruno Voisin------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the MacOSX-TeX mailing list