[XeTeX] Synching PDF paper size with typesetting size

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sat Nov 5 21:55:39 CET 2011


On Sat, Nov 05, 2011 at 02:06:43PM -0400, Karljurgen Feuerherm wrote:

> Usually, I need to use US letter paper size--but for one document I'm
> working on, I want B5. I'm using Memoir for this one, and have set B5
> accordingly.

Memoir is already capable to tell the media size to XeTeX and
it does it automatically:

\newcommand*{\fixpdflayout}{%
  \pdfpageheight=\the\stockheight
  \pdfpagewidth=\the\stockwidth
  \ifxetex\else
  \ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi
  \ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi
  \fi}
\newcommand*{\fixdvipslayout}{%
  \AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}}}

\AtBeginDocument{%
  \ifxetex
    \fixpdflayout
  \else
    \ifpdf
      \ifnum\pdfoutput<\@ne
        \fixdvipslayout
      \else
        \fixpdflayout
      \fi
    \else
      \fixdvipslayout
    \fi
  \fi}

Therefore you do *not* need:
* setting the media size manually using \pdfpagewidth and \pdfpageheight,
* using package geometry,
* command line options for XeTeX/xdvipdfmx.

A minimal example shows that memoir indeed sets the correct
paper size:

% File: test.tex
% Command line: xelatex test.tex

\listfiles
\documentclass[b5paper]{memoir}
\begin{document}
Hello World
\end{document}

 *File List*
  memoir.cls    2011/03/06 v3.6j configurable book, report, article
                document class
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
   mem10.clo    2008/01/30 v0.3 memoir class 10pt size option
mempatch.sty    2009/07/24 v6.0f Patches for memoir class v1.6180339
 ***********


Media size of the generated PDF file is 498.9bp x 708.66bp
or 176mm x 250mm that is the correct size for B5.

If your memoir comes from the stone age (before XeTeX and its support),
then update. Otherwise a minimal example and the command line call
help in finding the cause of your problem.

Yours sincerely
  Heiko Oberdiek


More information about the XeTeX mailing list