[texhax] When to modify \topmargin and \textheight?

Heiko Oberdiek heiko.oberdiek at googlemail.com
Mon Aug 30 15:29:19 CEST 2010


On Mon, Aug 30, 2010 at 03:05:09PM +0200, Procházka Lukáš Ing. - Pontex s. r. o. wrote:

> \documentclass[11pt,a4paper]{article}
> 
> \usepackage[cp1250]{inputenc}
> \usepackage[english]{babel}
> \usepackage{blindtext}
> 
> \begin{document}
> 
>   \Blindtext[8]
> 
>   \newpage
>   \addtolength{\textheight}{1.in}
>   \addtolength{\topmargin}{-.5in}
> 
>   \Blindtext[8]
> 
> \end{document}
> 
> 
> This code produces pdf of four pages (pdflatex, TL2009, WinXP):
> 
> - Page 1, 2 - pages use standard (non-modified) page layout.
> 
> - Page 3 - the page content is shifted up as the \topmargin has been
>   modified. The text height keeps the original value (?) of \textheight,
>   like \textheight were not modified.

At \begin{document} LaTeX initializes other length registers
with the value of \textheight, thus these length registers need
to be corrected, too.

  \addtolength{\textheight}{1in}
  \addtolength{\vsize}{1in}
  \makeatletter
  \addtolength{\@colht}{1in}
  \addtolength{\@colroom}{1in}
  \makeatother
  \addtolength{\topmargin}{-.5in}

Other possiblity is using \newgeometry from package `geometry'.

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list