[tex-live] TeXLive 2009: XeLaTeX: Undefined control sequence with mag!=1000

Heiko Oberdiek oberdiek at uni-freiburg.de
Fri Dec 4 10:27:25 CET 2009


On Thu, Dec 03, 2009 at 11:52:46PM +0000, Karl Berry wrote:

>     just fresh taken from a user report
>     (http://bugzilla.novell.com/show_bug.cgi?id=559257)
> 
> Here is Jonathan's reply, if someone would like to experiment.
> 
> 
> Date: Thu, 3 Dec 2009 22:52:29 +0000
> From: Jonathan Kew <jfkthame at googlemail.com>
> 
> The best way to set page size in xetex is indeed by using
> \pdfpage{height,width}, so the geometry.cfg file deliberately uses the
> pdftex setup. However, it seems this won't work with non-default
> magnification, because the driver then wants to use the \pdf*origin
> commands as well, and those aren't supported.
> 
> (I wasn't aware of this, obviously, but I'm surprised it hasn't come up
> previously - unless geometry.sty has recently changed. The xetex config
> has been this way for a long time.)
> 
> I'm just about to leave for a week in California, and won't have a
> chance to really think about this right away, sorry. Maybe it'd be best
> to change geometry.cfg to use the dvipdfm driver. I'm not sure what
> other interactions that may have, though.

I had tried this, but the result is wrong:

\documentclass{article} 
\usepackage[mag=1500,dvipdfm]{geometry} 
\begin{document} 
Hi 
\end{document} 

| This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009)
| ...
| *geometry detected driver: dvipdfm*
| ...

pdfinfo test.pdf:

| Page size:      1376.99 x 1781.99 pts

Correct (using pdflatex) is:

| Page size:      918 x 1188 pts

> At least there's a simple workaround, apparently.

geometry should be fixed by detecting XeTeX directly.
At least it doesn't touch \pdf(h,v)origin if they aren't defined.
But
  *geometry detected driver: pdftex*
will remain confusing when running xelatex.

Otherwise driver pdftex is still the best choice, but
geometry must then be fooled about \pdfhorigin.

My proposal for geometry.cfg until geometry is fixed
(then use \@ifpackagelater):

% geometry.cfg with detection for XeLaTeX
% 2009-12-04 v1.1 Heiko Oberdiek
% 2006-06-07 Jonathan Kew
% Public domain
\ProvidesFile{geometry.cfg}[2009/12/04 v1.1 Configuration for geometry]
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXversion\endcsname\relax
  % \XeTeXversion remains undefined
\else
  \PackageInfo{geometry.sty}{Using "pdftex" driver for XeTeX}%
  % XeTeX supports \pdfpagewidth and \pdfpageheight
  \Gm at setdriver{pdftex}
  % don't check this AtBeginDocument, just believe me!
  \let\Gm at checkdrivers\relax
  % However we have to fool geometry about the missing \pdfhorigin
  % and \pdfvorigin. But they shouldn't provided as count registers
  % globally all the time to prevent fooling others.
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname pdfhorigin\endcsname\relax
    \newcount\geometry at cfg@pdfhorigin
    \newcount\geometry at cfg@pdfvorigin
    \AtBeginDocument{%
      % being cautioness
      \begingroup\expandafter\expandafter\expandafter\endgroup
      \expandafter\ifx\csname pdfhorigin\endcsname\relax
        \let\pdfhorigin\geometry at cfg@pdfhorigin
        \let\pdfvorigin\geometry at cfg@pdfvorigin
      \fi
    }%
    \AtEndOfPackage{%
      \AtBeginDocument{%
        \ifx\pdfhorigin\geometry at cfg@pdfhorigin
          \let\pdfhorigin\@undefined
          \let\pdfvorigin\@undefined
        \fi
      }%
    }%
  \fi
\fi
\endinput
% End of file `geometry.cfg'.

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


More information about the tex-live mailing list