[pdftex] Bug in `pdftex.def' (page key)?

Heiko Oberdiek oberdiek at uni-freiburg.de
Wed Feb 12 15:31:46 CET 2003


On Wed, Feb 12, 2003 at 01:37:23PM +0100, Rolf Niepraschk wrote:

> Ross Moore wrote:
> >> 
> >> The \includegraphics command in the following LaTeX example produces the
> >> error
> >> ---------------------------
> >> ! Package keyval Error: page undefined.
> >> ---------------------------
> >> 
> >> This should not happen...
> >> 
> >> %---------------------------
> >> \documentclass{article}
> >> 
> >> \usepackage{graphics}

This loads pdftex.def. It detects that there is no keyval.sty loaded.
So it does not execute \define at key for the new option "page". But
it adds code in \AtBeginDocument to repeat the test for \define at key.

> >  \AtBeginDocument{\usepackage{graphicx}}

Package graphicx will load package keyval, but does not define
"page" and some other options.

Now at \begin{document} the following happens:

1. Test for \define at key of pdftex.def and definition of
   option "page" and other options if \define at key/keyval.sty
   is present.
     But it is not loaded, so "page" is undefined.
2. Graphicx.sty is loaded with keyval.sty, too late.

> > Surely just using
> >    \usepackage{graphicx}
> > is enough.
> 
> No. The code should work inside of a package. I will check if the user
> has already loaded `graphicx'...

Then you have to load at least package keyval:

\usepackage{keyval}
\AtBeginDocument{\usepackage{graphicx}}

> Everything works fine _except_ the page key! Try it with "page=1"
> replaced by "width=2cm"...

Yes, this is the main problem, how/where to define options that
are not already defined in graphicx, but are needed by the driver?

The only alternative for pdftex.def without the forced loading
of keyval.sty is as far as I can see:
* No use of keyval's macros \define at key and \KV at def, but
  using the more basic lower level commands (\@namedef, \csname).
  Thus the options would also be defined without package keyval.
  (useless in this case, but it should not cause harm.)

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 


More information about the pdftex mailing list