\iftextures? (was: [OS X TeX] \colordvi in plain tex)

Bruno Voisin bvoisin at mac.com
Sun Mar 6 19:51:03 CET 2005


Le 6 mars 05, à 19:07, Maarten Sneep a écrit :

> On 6 mrt 2005, at 19:00, Bruno Voisin wrote:
>
>> newif\ifpdf
>> \ifx\pdfoutput\undefined
>>   \pdffalse
>> \else
>>   \pdftrue
>> \fi
>>
>> ifpdf.sty does essentially the same, but with a lot of tests 
>> beforehand to look whether the switch has already been defined etc.
>
> ifpdf.sty uses some of the code, but also checks the _value_ of 
> \pdfoutput if it is defined.
> Your code fails on pdftex --output-format=dvi, please use the 
> maintained and debugged
> code in ifpdf.sty. ifpdf.sty can be used under both tex and latex 
> (\input ifpdf.sty or
> \usepackage{ifpdf} respectively.)

Is the modification required to make the above work amenable to writing 
instead (from ifpdf.sty):

\newif\ifpdf
\ifx\pdfoutput\undefined
\else
   \ifx\pdfoutput\relax
   \else
     \ifcase\pdfoutput
     \else
       \pdftrue
     \fi
   \fi
\fi

I think that's also the kind of test color.cfg and graphics.cfg are 
doing. The step \ifx\pdfoutput\relax I don't understand.

Regarding ifpdf.sty, I must say I'm not very fond of bloated packages 
which seem like the art of making simple things look difficult. But, as 
you said, probably all these precautions are necessary.

Plus I like to minimize the number of external packages my TeX input 
files rely upon, when what the packages do can be implemented, even if 
less robustly, in a couple of lines. Personally I like to limit the 
packages I use to CTAN's latex/required directory, for the sake of 
portability, plus a couple of others, on a per-package basis, when that 
cannot be avoided. Probably that comes from years of use of Textures 
and OzTeX, when the latex/required directory (or even latex/base for 
early-days Textures) was the only available one, and additional 
packages needed to be downloaded and -- when that was possible, which 
wasn't always the case -- adapted to the Textures and OzTeX specific 
capabilities and syntaxes. But again, as you said, ifpdf.sty is 
maintained and debugged, and teTeX and TeXLive are becoming standard on 
all platforms, so there's probably no harm done in relying on it. Just 
so much for independence!

And finally, being a purist, I don't feel good using a .sty file in 
plain TeX, in the same way as I don't feel good using \def in LaTeX. 
But I agree that's more akin to psycho-rigidity than common sense.

Bruno
--------------------- 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 Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list