My document should be letterpaper and my attachments should be a4paper. I had high hopes for the \newgeometry command from the geometry package, but the documentation says

\newgeometry is almost similar to \geometry except that \newgeometry disables all the options specified in the preamble and skips the papersize-related options: landscape, portrait and paper size options (such as papersize, paper=a4paper and so forth).

Any help is appreciated!

  • In case someone is looking for a similar solution for ConTeXt, the ConTeXt wiki shows how to change paper size mid document
    – Aditya
    Commented Jun 22, 2011 at 21:18

3 Answers 3


The following works in PDFLaTeX:

Normal page
\eject \pdfpagewidth=3in \pdfpageheight=10in
Tall page
\eject \pdfpagewidth=10in \pdfpageheight=3in
Wide page

That should work with Xelatex. See the SO qn, Change paper size in the middle of a latex document?, for more.

  • 3
    When I use that, how can I reset everything to the page dimension of the document class for the next page? Commented Feb 18, 2011 at 14:28
  • 3
    @Warren: These are normal dimension variables, so you can save the current values of the pages in the usual way using, say, \classpageheight=\pdfpageheight at the beginning and restore using \pdfpageheight=\classpageheight. Commented Feb 19, 2011 at 21:33
  • 5
    @CharlesStewart : do you mean "\newlength{\classpageheight} \setlength{\classpageheight}{\pdfpageheight}" instead of "\pdfpageheight=\classpageheight"? (as I cannot get the stanza with the = to work)... Thanks!
    – sdaau
    Commented May 11, 2012 at 10:08
  • 2
    @sdaau: Yes, you need to tell Tex that \classpageheight is a dimension using \newdim or \newlength, or as you have found, the assignment (using = or \setlength) won't work. Commented May 14, 2012 at 18:45
  • 1
    Anything that works with lualatex?
    – MaxNoe
    Commented Feb 19, 2018 at 14:56

You can use the typearea package (KOMA-Script bundle) to change the paper size and also recalculate all dependent margins, header and footer positions etc. The following code demonstrates the technique but generates some warnings related to offended typesetting rules (placing 10pt font on A3 is not recommended). You might need to adjust some further typearea settings for better results.

\usepackage{lipsum}% dummy code

\lipsum% Placed on A4

\lipsum% Placed on A3

\lipsum% Placed on A4 again


Some KOMA-Script options trigger a recalculation of the type area and the “page setup” automatically, but paper does not. Nevertheless, a recalculation mid-document results in a new page, so no \clearpage, \newpage or \eject is necessary here.

  • 2
    if anyone else got wondering what's the package name responsible for this code, it is koma-scripts Commented Jan 9, 2016 at 0:12
  • 2
    Checkout this answer to use custom sizes pages Commented Feb 13, 2020 at 9:27
  • If you do not need specific margins simply use: ""\KOMAoptions{paper=250mm:500mm, paper = landscape, DIV=15} \recalctypearea"" -- DIV sets roughly the margins based on the font. -- paper = landscape or portrait sets the larger length as the width/height respectively Commented Apr 12, 2023 at 23:31
  • Note that the format is different from that of geometry package, and also more restrictive: "Size supports the American formats letter, legal, and executive. In addition, it supports the ISO formats of the series A, B, C, and D, for example A4 or — written in lower case — a4." So for example ansibpaper has no equivalent (practically this is hardly a problem though).
    – user202729
    Commented May 4 at 9:57
  • @user202729 On the other hand typearea provides not only a0paper…a6paper but also a7paper, a8paper etc. and similar for b and c and also for d, which is not supported by geometry. But feel free to make a feature request, if you think, it should also provide ansia, ansic, ansid, ansie, b0j…bNj. BTW: Is the b6j size in geometry correct? The rounding from b5j→b6j seems to be different than b4j→b4j.
    – cabohah
    Commented May 4 at 10:41

Here is an abridged example which switches between two custom page sizes with corresponding layouts (margins), which can compile with pdflatex - for more details, see my answer in Problem with setting correct custom page size with 'geometry' in xelatex:


% reminder: US letter: 596pt x 795pt



% stockwidth and stockheight - from memoir,
% here just for cheating `layouts` warnings


% this command will take effect into L1 layout just after \begin{document}
% but the L1 geometry will otherwise be ignored


  {\typeout{^^J*******\string\drawpage fixed*******^^J}}%
  {\typeout{^^J*******\string\drawpage not fixed*******^^J}}


  % from geometry.sty:
  * paper: \ifx\Gm@paper\@undefined<default>\else\Gm@paper\fi \\%
  * layout: \ifGm@layout<custom>\else<same size as paper>\fi \\%
  * layout(width,height): (\the\Gm@layoutwidth,\the\Gm@layoutheight) \\%
  * layoutoffset:(h,v)=(\the\Gm@layouthoffset,\the\Gm@layoutvoffset) \\%
  \pagevalues % from package layouts



  % switch page size first:
  \pdfpagewidth=\pagewidthA \pdfpageheight=\pageheightA % for PDF output
  \paperwidth=\pagewidthA \paperheight=\pageheightA     % for TikZ
  \stockwidth=\pagewidthA \stockheight=\pageheightA % hyperref (memoir)?!
  \loadgeometry{LayoutPageA} % note; \loadgeometry may reset paperwidth/h!

  % switch page size first:
  \pdfpagewidth=\pagewidthB \pdfpageheight=\pageheightB % for PDF output
  \paperwidth=\pagewidthB \paperheight=\pageheightB     % for TikZ
  \stockwidth=\pagewidthB \stockheight=\pageheightB % hyperref (memoir)?!
  \loadgeometry{LayoutPageB} % note; \loadgeometry may reset paperwidth/h!

  % here geometry layout L1 is instantiated;
  % without anything else, paper size defaults to US letter!
  % \restoregeometry command restores L1!!

  \fontsize{8}{9}\selectfont % this nowork in preamble!

  % generate page layouts first based on layoutwidth as page size;
  % don't switch actual page sizes yet:

  %%% start with content

  % start with LayoutPageA (includes switching page size)

    \pagestyle{empty} % no page numbers here

  % switch to LayoutPageB (includes switching page size)

    % start page numbering here ("this will reset the page number"):
    % make page numbers visible






You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .