1

When changing the paper size within a document, the fancyhdr package does not recognize the alteration of the layout width.

This page details how to change page size mid-document.
An answer has been given which uses \pdfpagewidth.
An answer has been given which uses \KOMAoptions.
Neither solves fancyhdr horizontal justification.

MWE

\documentclass{scrartcl}

\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{lipsum}

% Margin Settings:
\geometry{letterpaper}
\geometry{vmargin    = 0.50in,
          hmargin    = 0.50in,
          headheight = 0.50in,
          headsep    = 0.15in,
          footskip   = 0.60in}
\usepackage{showframe}


%Initialize headers and footers
\pagestyle{fancy}
\fancyhf{}                           % Clears out artifacts from default header
\fancyhead[C]{Header}
\fancyfoot[C]{Footer}
\fancyfoot[R]{ Page \thepage}        % Begin footer page number
\renewcommand{\headrulewidth}{0pt}   % Removes default horizontal line

\begin{document}
{\Huge \textbf{Original}}
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 04.25in,
             layoutheight = 11.00in}
\pdfpagewidth  = 04.25in 
\pdfpageheight = 11.00in
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 04.25in,
             layoutheight = 11.00in, 
             vmargin      = 00.50in, 
             hmargin      = 00.50in,
             headheight   = 00.50in,
             headsep      = 00.15in,
             footskip     = 00.60in}
\pdfpagewidth  = 04.25in 
\pdfpageheight = 11.00in
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 11.00in,
             layoutheight = 04.25in,
             vmargin      = 00.50in, 
             hmargin      = 00.50in,
             headheight   = 00.50in,
             headsep      = 00.15in,
             footskip     = 00.60in}
\pdfpagewidth  = 11.00in 
\pdfpageheight = 04.25in
\lipsum[1]

\clearpage 
\newgeometry{layoutwidth  = 17.00in,
             layoutheight = 11.00in,
             vmargin      = 00.50in, 
             hmargin      = 00.50in,
             headheight   = 00.50in,
             headsep      = 00.15in,
             footskip     = 00.60in}
\pdfpagewidth  = 17.00in
\pdfpageheight = 11.00in
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 08.50in,
             layoutheight = 11.00in,
             vmargin      = 00.50in, 
             hmargin      = 00.50in,
             headheight   = 00.50in,
             headsep      = 00.15in,
             footskip     = 00.60in}
\pdfpagewidth  = 08.50in 
\pdfpageheight = 11.00in
{\Huge \textbf{Original}}
\lipsum[1]

\clearpage 
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\lipsum[1]

\clearpage 
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\newgeometry{layoutwidth  = 17.00in,
             layoutheight = 11.00in,
             vmargin      = 00.50in, 
             hmargin      = 00.50in,
             headheight   = 00.50in,
             headsep      = 00.15in,
             footskip     = 00.60in}
\lipsum[1]

\end{document}

Also: Can a user create and append a mid-document tag? I feel that some users receive preamble advice when seeking in-document advice.

  • 1
    Why are you using fancyhdr with a KOMA-class? You get warnings. Better to use scrlayer-scrpage form the KOMA-bundle which will just work perfectly. – Johannes_B Jun 18 '15 at 17:18
  • @Johannes_B: Constantly fighting against the windmills of wrong usage of KOMA ;-) – user31729 Jun 18 '15 at 17:37
  • @ChristianHupfer Nah, but scrlayer-scrpage is just better with a KOMA-class. You woudn't recommend fancyhdr with memoir, right? – Johannes_B Jun 18 '15 at 17:38
  • @Johannes_B: Nope ;-) – user31729 Jun 18 '15 at 17:57
3

I would replace fancyhdr and use the package that is developed to work with KOMA-classes (and standard classes), called scrlayer-scrpage. The package officially replaced the older scrpage2 last year. Currently, the author of KOMA-script adds functionality regularly, so a fairly up to date distribution is recommenden.

\documentclass{scrartcl}

\usepackage{geometry}
\usepackage{lipsum}

% Margin Settings:
\geometry{letterpaper}
\geometry{vmargin    = 0.50in,
    hmargin    = 0.50in,
    headheight = 0.50in,
    headsep    = 0.15in,
footskip   = 0.60in}
\usepackage{showframe}

\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\chead{Header}
\cfoot{footer}
\ofoot{\pagemark}

\begin{document}
{\Huge \textbf{Original}}\par
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 04.25in,
layoutheight = 11.00in}
\pdfpagewidth  = 04.25in 
\pdfpageheight = 11.00in
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 04.25in,
    layoutheight = 11.00in, 
    vmargin      = 00.50in, 
    hmargin      = 00.50in,
    headheight   = 00.50in,
    headsep      = 00.15in,
footskip     = 00.60in}
\pdfpagewidth  = 04.25in 
\pdfpageheight = 11.00in
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 11.00in,
    layoutheight = 04.25in,
    vmargin      = 00.50in, 
    hmargin      = 00.50in,
    headheight   = 00.50in,
    headsep      = 00.15in,
footskip     = 00.60in}
\pdfpagewidth  = 11.00in 
\pdfpageheight = 04.25in
\lipsum[1]

\clearpage 
\newgeometry{layoutwidth  = 17.00in,
    layoutheight = 11.00in,
    vmargin      = 00.50in, 
    hmargin      = 00.50in,
    headheight   = 00.50in,
    headsep      = 00.15in,
footskip     = 00.60in}
\pdfpagewidth  = 17.00in
\pdfpageheight = 11.00in
\lipsum[1]

\clearpage
\newgeometry{layoutwidth  = 08.50in,
    layoutheight = 11.00in,
    vmargin      = 00.50in, 
    hmargin      = 00.50in,
    headheight   = 00.50in,
    headsep      = 00.15in,
footskip     = 00.60in}
\pdfpagewidth  = 08.50in 
\pdfpageheight = 11.00in
{\Huge \textbf{Original}}
\lipsum[1]

\clearpage 
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\lipsum[1]

\clearpage 
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\newgeometry{layoutwidth  = 17.00in,
    layoutheight = 11.00in,
    vmargin      = 00.50in, 
    hmargin      = 00.50in,
    headheight   = 00.50in,
    headsep      = 00.15in,
footskip     = 00.60in}
\lipsum[1]

\end{document}

As you can see, the header are where they are supposed to be.

  • pay attention, almost all of your footers are cut off the page. – Johannes_B Jun 18 '15 at 17:25
  • Understood. So, to be sure, ditch fancyhdr from now on and just learn KOMA footers? I think it's good that the package is included in the code, but I think you should add its actual title to your intro text. – kando Jun 18 '15 at 17:28
  • 1
    @kando Sorry, forgot that. scrlayer-scrpage (and its underlying scrlayer) are very very powerful. Plaese have a look around what user @esdd can do with it ;-) tex.stackexchange.com/search?q=user%3A43317+scrlayer-scrpage – Johannes_B Jun 18 '15 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.