I'm trying to set the page size using the geometry
package as shown in the following MWE, compiled with xelatex test.tex
:
\documentclass[12pt]{article}
\usepackage[b5paper,pass]{geometry}
\geometry{b5paper}
\usepackage{tikz,enumitem}
\usepackage{fix-cm}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Junicode}
\usepackage{layouts}
\usepackage{etoolbox}
\patchcmd{\drawpage}{\ifdrawparameters}{\iftrue}%
{\typeout{^^J*******\string\drawpage fixed*******^^J}}%
{\typeout{^^J*******\string\drawpage not fixed*******^^J}}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\end{document}
If I then try to check the page size using pdfinfo
(on Ubuntu), I get size of US letter (?!):
$ pdfinfo -box -f 1 -l 1 test.pdf | grep Page
Pages: 1
Page 1 size: 612 x 792 pts (letter)
Page 1 MediaBox: 0.00 0.00 612.00 792.00
Page 1 CropBox: 0.00 0.00 612.00 792.00
Page 1 BleedBox: 0.00 0.00 612.00 792.00
Page 1 TrimBox: 0.00 0.00 612.00 792.00
Page 1 ArtBox: 0.00 0.00 612.00 792.00
However, if I enter b5paper
in \documentclass[b5paper,12pt]{article}
- then I can just as well delete all the other references to geometry
using b5paper
- because when I compile with that change, I get:
$ pdfinfo -box -f 1 -l 1 test.pdf | grep Page
Pages: 1
Page 1 size: 498.9 x 708.66 pts
Page 1 MediaBox: 0.00 0.00 498.90 708.66
Page 1 CropBox: 0.00 0.00 498.90 708.66
Page 1 BleedBox: 0.00 0.00 498.90 708.66
Page 1 TrimBox: 0.00 0.00 498.90 708.66
Page 1 ArtBox: 0.00 0.00 498.90 708.66
... which (I guess) corresponds to correct B5 measures.
Now, as far as I had believed until now - one should be able to change the paper size with geometry
- as long as those changes are issued before \begin{document}
, is that correct? If so, why doesn't it work here?
I'm wandering, because I wanted to set some custom page sizes with geometry
in this way (and which thus I couldn't propagate to the \documentclass
command).
Many thanks in advance for any suggestions on how to set a custom page size in this example,
Cheers!
b5paper
as an option to\documentclass
rather than togeometry
.\documentclass
, since I want to set custom page sizes.. I came up with a sort of a hack below, but I'm not sure if that is the way custom page sizes should be handled.. Thanks again - cheers!