[XeTeX] xelatex and geometry

Ulrike Fischer news2 at nililand.de
Wed Mar 26 16:15:06 CET 2008


Am Wed, 26 Mar 2008 14:33:15 +0000 schrieb Jonathan Kew:


>>> Why not simply use
>>>
>>> 	\usepackage{geometry}
>>>
>>> and in cases (La|Xe)TeX cannot know which output driver will be used,
>>> start with:
>>>
>>> 	\documentclass[dvips|dvipdfm|...]{article}
>>
>> This only moves the need for a switch to the documentclass. And the
>> switch gets more complicated as you now will have to differenciate
>> between xetex/pdflatex/dvips if you don't want e.g. graphics or  
>> hyperref
>> to use the wrong drivers.
>>
>> I prefer to declare the driver locally only for geometry. All other
>> packages that I use regularly get the right driver either  
>> automatically
>> or have a sensible default (dvips). geometry is the only package where
>> the dvips-Option must be given.
> 
> What does it do under latex if no option is given?

If you use 
\usepackage[a5paper]{geometry}
with the current geometry.cfg of XeTeX, no global option and no other
geometry.cfg you get with:

LaTeX+dvips: wrong page size, no \special in the dvi, so the default a4
             ist used.                       
pdflatex:    correct page size: geometry sets \pdfpageheight +width
XeLaTeX:     correct page size: geometry sets \pdfpageheight +width


With 
\usepackage[dvips,a5paper]{geometry}
you get:

LaTeX+dvips: correct page size: geometry put a dvips-\special in the dvi
pdflatex:    correct page size: geometry sets \pdfpagewidth + height
XeLaTeX:     wrong page size: geometry does neither of the two


> Does \usepackage[dvipdfm]{geometry} work with xelatex? When you run  
> xelatex, you're actually using a dvipdfm-based driver, so that's the  
> closest logical option if you insist on specifying one.

The specials for dvipdfm and dvips are already quite clore: They doesn't
differ. The only difference between dvips and dvipdfm in geometry is the
handling of landscape. 

And no, it doesn't work with XeLaTeX. And for the same reason dvips
doesn't work: This sets the driver to dvipdfm, but as the geometry.cfg
disables the \Gm at checkdrivers command, 
\ifx\Gm at driver\Gm at dvipdfm
       \Gm at specialtrue
    \fi
is never executed and so \ifGm at special is still false. And so you get no
dvipdfm-specials in the dvi and \pdfpageheight+width aren't set too.  


> If you want geometry to default to its dvips mode when no driver is  
> specified, you can create your own local geometry.cfg file to make  
> this happen.

Yes I can do this. But what's wrong with the geometry.cfg I suggested
which redefines \Gm at checkdrivers so that there is no longer a test for
\pdfoutput? Then \usepackage[dvixxx,...]{geometry} will issues specials
when used with latex+dvixxx, and set \pdfpageheight+width when used with
pdflatex or XeLaTeX.

%% geometry.cfg for XeLaTeX - UF 2008-03-26
% Public domain

\@ifundefined{XeTeXversion}{}{%
 \def\Gm at checkdrivers{%
  \ifx\pdfpagewidth\@undefined\else
    %\ifnum\pdfoutput=\@ne
      \Gm at setdriver{pdftex}%
    %\fi
  \fi
  \ifx\VTeXversion\@undefined\else
    \ifnum\OpMode=\@ne
      \Gm at setdriver{vtex}%
    \else
      \ifnum\OpMode=\tw@
        \Gm at setdriver{vtex}%
      \fi
    \fi
  \fi
  \ifx\Gm at driver\Gm at dvips
    \Gm at specialtrue
  \else
    \ifx\Gm at driver\Gm at dvipdfm
       \Gm at specialtrue
    \fi
  \fi}}

\endinput

%% End of file `geometry.cfg'.



-- 
Ulrike Fischer 



More information about the XeTeX mailing list