[XeTeX] ifxetex package

Ross Moore ross at ics.mq.edu.au
Mon Jun 19 03:24:31 CEST 2006


Hi Will, and Bruno

On 19/06/2006, at 10:33 AM, Will Robertson wrote:

> On 19/06/2006, at 2:00 , Bruno Voisin wrote:
>
>> Did you look at all the checks made by ifpdf.sty and ifvtex.sty, to
>> make sure the package is loaded only once even if called several
>> times by other packages, and to make sure the \ifpdf and \ifvtex
>> switches return the correct value whatever version of pdfTeX and VTeX
>> is running? In XeTeX, in particular, that would mean \ifxetex
>> returning a correct value even when called on a version of XeTeX in
>> which \XeTeXversion had not been introduced.
>>
>> Do you think it would be worth wandering into the same level of
>> complexity for XeTeX?
>
> Hi Bruno,
>
> LaTeX itself ensures than a package is only loaded once, and for
> Plain I've only added enough smarts that you at least shouldn't get
> error messages.

Yes, but that assumes the user tried to load using  XeLaTeX .
Would this not also be useful for XeTeX (without LaTeX) ?
In particular, it'd be desirable to have it working properly
with
   \input miniltx.tex
   \input ifxetex.sty


>
> Why would there be a version of XeTeX *without* the primitive
> \XeTeXversion?
>
> \ifpdf and \ifvtex are provided by their respective packages -- no
> point me copying their functionality.
>
> After uploading this package, I felt a bit silly. I don't think this
> needs to be in a package by itself. It's easy enough to say
>    \ifdefined\XeTeXversion...\fi

Be careful here.
\ifdefined is *not* a LaTeX command, nor a TeX one.

If you mean the LaTeX internal  \@ifundefined ,
then you need to change catcodes to make this work.

If you mean
   \ifx\undefined\XeTeXversion ... \fi
then the best 1-liner uses non-trivial TeX coding;
e.g.
   \ifx\undefined\XeTeXversion\expandafter\endinput\fi

But even this is not 100% safe, as a user may have
given  \undefined  a meaning (e.g. to mean something
mathematical.

Thus it is even better to use:

   \expandafter\ifx\csname XeTeXversion\endcsname\relax
   \else\expandafter\endinput\fi

which uses so much non-trivial TeX that it doesn't comes easily.

Even better still (why ?) is:

   \begingroup
    \expandafter\ifx\csname XeTeXversion\endcsname\relax
     \aftergroup\endinput\fi
   \endgroup



>
> So maybe I'll end up removing it from CTAN...on the other hand maybe
> there is something that will pop up to be useful to include in there.

Consider my comments above.

You should think about how someone might like to use such
a package, in contexts for which the basic idea is valid,
but for which you didn't originally design it.
This is the best way to avoid unforeseen circumstances
arising in the future.


>
> Will


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------




More information about the XeTeX mailing list