\input graphicx
\includegraphics{MyPicture}
\bye
I can also color text with
\input color
\textcolor{red}{bbb}
\bye
But I am not able two get both color AND pictures. The following example
\input color
\input graphicx
\bye
produces the error message
! Use of \@ doesn't match its definition.
l.27 \@m
akeother\"%
Changing the order of the \input's produces a different message:
! Undefined control sequence.
<argument> \@notdefinable
\@secondoftwo #1#2->#2
l.72 ...nextchar[\@undeclaredcolor\@declaredcolor}
I am using pdftex in MacOS X 10.4.3 ( Gerben Wierda's installation) and
TeXshop. From the log window:
This is pdfeTeX, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5)
How can I make the two packages work together?
Thank you in advance,
Julian Aguirre
Universidad del Pais Vasco
This:
\input color
\makeatletter
\input graphicx
\bye
seems to work.
When I need graphics or color in plain tex, I use the following code in
a personal
macro file:
\input miniltx
\makeatletter
\ifx\Gin@driver\undefined
\def\Gin@driver{dvips.def}
\fi
\input graphicx.sty
\resetatcatcode
And a similar set of commands for inputting color.sty. The little \ifx
test is so that I can change the driver by defining \Gin@driver before
inputting these macros.
Dan
Thank you for your answer, but things are getting more misterious (at
least to me).
\input color
\makeatletter
\input graphicx
\includegraphics[width=.4\hsize]{LogoUned}
\bye
works as expected BUT
\input color
\makeatletter
\input graphicx
\textcolor{red}{Hola}
\bye
produces no output (it seems like if TeX stopped processing inmediatly
after reading the \textcolor command).
I just realized you are using pdftex. You must use tex+dvips with
graphicx.tex and color.tex as they are written. They explicitly set the
driver file to dvips.def. Some versions of graphics.cfg and color.cfg
will override that, but even if it is changed to pdftex.def, there are
problems: as you say \textcolor seems to hang.
I'll try to diagnose this and see if a work-around can be found.
However, pdftex and support files change frequently and miniltx perhaps
hasn't kept up.
Dan
The diagnosis: it appears that pdftex.def is loaded twice. I believe
LaTeX prevents that from happening. In that file there is code that
saves the ``current'' definition of \color in \@ldc@l@r and redefines
\color to <something>\@ldc@l@r. However, the second time through, the
current definition is the same as this one, so \color is defined in
terms of itself producing infinite recursion (resulting in TeX
hanging).
The perfect solution would be to modify pdftex.def so it detects its
second loading and exits. Alternatively, perhaps the plain graphics
package could be modified to prevent
this. More later if I can figure something out.
Dan
The following works in my plain TeX file:
\input miniltx
\makeatletter
\def\Gin@driver{pdftex.def}
\input color.sty
\@namedef{v...@pdftex.def}{}
\input graphicx.sty
\resetatcatcode
\textcolor{red}{Hola}
\includegraphics[width=.4\hsize]{image2.pdf}
\bye
The 5th line defines \v...@pdftex.def. The existence of a definition for
this is used by graphicx.sty to determine whether the file has already
been loaded. LaTeX's \ProvidesFile command, issued at the start of
every LaTeX input file, defines this command, but miniltx skips that
part in its substitute \def of \ProvidesFile.
Dan
>
> The following works in my plain TeX file:
>
> \input miniltx
> \makeatletter
> \def\Gin@driver{pdftex.def}
> \input color.sty
> \@namedef{v...@pdftex.def}{}
> \input graphicx.sty
> \resetatcatcode
>
> \textcolor{red}{Hola}
> \includegraphics[width=.4\hsize]{image2.pdf}
>
> \bye
>
> The 5th line defines \v...@pdftex.def. The existence of a definition for
> this is used by graphicx.sty to determine whether the file has already
> been loaded. LaTeX's \ProvidesFile command, issued at the start of
> every LaTeX input file, defines this command, but miniltx skips that
> part in its substitute \def of \ProvidesFile.
This modification of miniltx.tex works in simple cases:
Change:
\def\ProvidesPackage#1{\@ifnextchar[%
{\@pr@videpackage{#1}}{\@pr@videpackage#1[]}}
\def\@pr@videpackage#1[#2]{\wlog{#1: #2}}
\let\ProvidesFile\ProvidesPackage
to:
\def\ProvidesFile#1{\@ifnextchar[%
{\@pr@videfile{#1}}{\@pr@videfile#1[]}}
\def\@pr@videfile#1[#2]{\wlog{#1: #2}\@namedef{ver@#1}{#2}}
\def\ProvidesPackage#1{\ProvidesFile{#1.sty}}
Dan
The code would look like this:
\ilet\primitiveinput=\input
\input eplain
\beginpackages
\usepackage{color}
\usepackage{graphics}
\endpackages
\let\input=\primitiveinput
(The \input stuff is because miniltx redefines \input to be as in
LaTeX, which is unlikely to be what plain users want. The next version
of Eplain might do it automatically.)
HTH,
karl
It also supports (hopefully) all package options for color and
graphic{s,x}, and detects pdftex automatically. One option that does
not yet work is `draft'; to use it, add the following after `\input
eplain' and before the packages:
\makeatletter
\let\ttfamily\ttfam
\def\strip@prefix#1>{}
\makeatother
This should be fixed in the next version, too.
Julian Aguirre