[texhax] Automated package option choice possible?

Heiko Oberdiek heiko.oberdiek at googlemail.com
Mon Sep 13 22:49:27 CEST 2010


On Mon, Sep 13, 2010 at 04:13:49PM -0400, Beuthe, Thomas wrote:

> There are at least two packages that require option choices that depend on what program you are using to compile your LaTeX files:
> color and hyperref.
> 
> Compile in pdflatex?  You need to use the pdftex option.
> Using xelatex? You need to use xetex option, and so on.

No, both pdfTeX in PDF mode and XeTeX are autodetected
by hyperref and graphics.cfg/color.cfg (TL and other)

DVI driver options can't be autodetected, because the
DVI program is run *after* the TeX run is completed.

> Are there other packages that have similar requirements? (I'm curious)

Lots of packages are driver dependent.

> My main question: Is there any way of automating the choice of options?

The best you can achieve is:
* TeX processors like pdfTeX in PDF mode, XeTeX, VTeX, ...
  are autodetected.
* And a default is configured for DVI drivers.
  Or the DVI driver is given as global option.

> if(packagebeingusedtorun=xelatex) then
>   \usepackage[xetex]{color}
> 
> or something like that?

A package that provides autodetection and selection of drivers
would be useful, but a good design isn't too trivial.

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list