Sat Jun 18 15:46:44 2016, original submission:
After some discussion of page sizes on texlive list I came to the conclusion that the status quo of pdftex (and luatex) options setting the (PDF) page size based on the latex \paperheight/width settings but dvips and other drivers not doing that was not really justifiable.
From the June 2016 release, graphics and color have setpagesize and nosetpagesize options to explicitly request that the pdf size is or is not set. It defaults to setpagesize, matching the former pdflatex behaviour.
The package option just sets \ifGin@setpagesize to be true or false: it is up to the driver .def file to actually set the size. (It could have been factored slightly differently between package and back end code but this seemed the most compatible with existing uses.)
It would be good (or at least consistent) if xetex and dvipdfmx options supported this in the same way.
They could both use the \special{pagesize... syntax but I think probably it is best if xetex uses \pdfpageheight setting, like pdftex, and dvipdfmx uses the special, like dvips.
The required code blocks could be copied from pdftex.def and dvips.def and added just before \endinput, I put then below, for completeness.
As a test pdfinfo should show PDF generated from this test as 100x300 pts
\documentclass{article}
\paperheight=300bp
\paperwidth=100bp
\usepackage{graphicx}
\begin{document}
x
\end{document}
thanks for supporting these drivers,
David
for xetex.def:
\@ifundefined{ifGin@setpagesize}
{\expandafter\let\csname ifGin@setpagesize\expandafter\endcsname
\csname iftrue\endcsname}
{}
\ifGin@setpagesize
\ifx\paperwidth\@undefined\else
\AtBeginDocument{%
\ltx@IfUndefined{stockwidth}{%
\ltx@IfUndefined{paperwidth}{%
}{%
\ifdim\paperwidth>0pt\relax
\ifdim\paperheight>0pt\relax
\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\fi
\fi
}%
}{%
\ifdim\stockwidth>0pt\relax
\ifdim\stockheight>0pt\relax
\pdfpagewidth=\stockwidth
\pdfpageheight=\stockheight
\fi
\fi
}%
}
\fi
\fi
and for dvipdfm.def
\@ifundefined{ifGin@setpagesize}
{\expandafter\let\csname ifGin@setpagesize\expandafter\endcsname
\csname iftrue\endcsname}
{}
\ifGin@setpagesize
\ifx\paperwidth\@undefined\else
\AtBeginDocument{\AtBeginDvi{%
\begingroup
\ifx\stockwidth\@undefined\else
\paperwidth\stockwidth
\paperheight\stockheight
\fi
\ifdim\paperwidth>\z@
\ifdim\paperheight>\z@
\special{papersize=\the\paperwidth,\the\paperheight}%
\fi
\fi
\endgroup}}
\fi
\fi
|