I have a pdflatex document in which I switch paper sizes, just for one page, to display a large image. The page number is purposefully omitted from the larger page. I created macros for performing the switch to the larger size page also for switch back.
The first normal sized page after the image is missing a page number, but subsequent pages seem to work OK. Also, if I don't manually insert a page break with \clearpage
, it seems that the page is bottomless and my text goes on and on, invisible beyond the bottom of the page (this isn't demonstrated in the MWE below).
Here is a minimal working example. Any idea what's going on here?
\documentclass{article}
\usepackage{pdflscape}
% Macros for changing paper size
\newcommand{\startPaperSizeB}{%
\clearpage
\begingroup
\setlength{\pdfpagewidth}{11in}
\setlength{\pdfpageheight}{17in}
\setlength{\paperwidth}{\pdfpagewidth}
\setlength{\paperheight}{\pdfpageheight}
\setlength{\textwidth}{526pt}% This one matters
\setlength{\textheight}{984pt}% This one matters
\pagestyle{empty}% No page number
}
\newcommand{\stopPaperSizeB}{\endgroup \clearpage}% The order of these commands makes no difference
\begin{document}
Some stuff on the first page here.
\startPaperSizeB
\begin{landscape}
Text on second page, intended for large image.
\end{landscape}
\stopPaperSizeB
Why no page number here?
\clearpage
Page numbers start working here, no problem.
\end{document}
`
to mark your inline code as I did in my edit.\thispagestyle{empty}
, and/or use thegeometry
package to switch layouts mid-document (using\newgeometry
and\restoregeometry
).\pagestyle
command (or using\thispagestyle
instead) makes no difference. From thegeometry
package documentation: "\newgeometry
is almost similar to\geometry
except that\newgeometry
... skips papersize-related options." I did do some experimenting, but couldn't get the papersize to change mid-document usinggeometry
.