I have a problem with user-defined environments in LaTeX. Even though the content of an environment seems to fit, sometimes LaTeX makes an unneccessary page break after all.

Here is my MWE:





Irgendein Text\dots


\dots und am Ende eine Formel:

To keep it simple, the environment has an empty pre- and postcode. Furthermore \vspace{17.5cm} stands for any text of this length. But for some inexplicable reason pdfLaTeX puts an empty page after that. So my question is: What I am doing wrong and what I am misunderstanding? If I write the pre- and postcode directly without using environments, no further page appears - that's kinda strange.

  • \enlargethispage{1\baselineskip} solves the problem, but this is not that consistent. – Josef Oct 21 '12 at 15:26
  • 1
    See en.wikibooks.org/wiki/LaTeX/Customizing_LaTeX#Extra_space . Instead of \newenvironment{testenviron} {} {} use \newenvironment{testenviron} {\noindent\ignorespaces} {\par\noindent\ignorespacesafterend} – mythealias Oct 21 '12 at 15:29

By inserting the replacement text (an empty group {}) for your testenviron at both \begin{testenviron} and \end{testenviron}, you obtain the same result. My assumption is that you just commented out these lines, which lead to a 1-page document.

Ending your environment with a display equation causes any \end{testenviron} content to be set on a new line, even if it's an empty group.

How would you fix it? This depends on what you include in testenviron, or whether you usually end your environment with a display equation. Easiest, in this instance would be to ignore the empty space at the end using

  {}% \begin{testenviron}
  {\ignorespacesafterend}% \end{testenviron}
| improve this answer | |
  • Thank you for your further explanation. This solved my problem. – Josef Oct 21 '12 at 15:37

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.