I know it's generally considered to be unwise, but I need to understand what happens when \textheight
changes mid-document. From this example, it appears that the change takes effect on the next page, when \vsize
is changed.
\documentclass{article}
\begin{document}
\typeout{Page 1:}
\showthe\textheight
\showthe\vsize
abc
\newpage
\typeout{Page 2:}
\addtolength{\textheight}{1cm}
\showthe\textheight
\showthe\vsize
def
\newpage
\typeout{Page 3:}
\showthe\textheight
\showthe\vsize
ghi
\end{document}
Is this always the case?
Best Answer
It is not "unwise" to change
\textheight
in mid-document - it is unsupported and by changing it midway strange things can happen. On the whole you are right, if you do this then it appears to affect the next page, but there are dependencies to the float algorithm which are asynchronous to the pages (for example, a float is tested when encountered to ensure that it doesn't exceed\textheight
, and if so it will get artificially shortened so that the float algorithm can expect that all floats fit onto the page).But there are also other surprising side-effects: try out this example:
Here is what you get with and without the float on page 2 (the height reduction happens only from page 3 onwards):
But with the float already the second page gets shortened but has too much material now:
Now this is something one could argue is a LaTeX 2e (or even LaTeX2.09) bug, but then one could call it a feature as it is unsupported input.
In summary, if you need to understand what's really going on because you want to build something that changes
\textheight
then I fear you need to study all the places where it is being usedand whether what happens there can effect what you are trying to do --- but as I said it is not a supported interface variable.