9

I tried to define some environment but came across bad page breaks sometimes. The minimal working example is as follows:

\documentclass[b5paper]{article}
\usepackage{hyperref} % page break is correct when removing this line

\newcounter{question}
\newenvironment{question}{\par\refstepcounter{question}\thequestion. }{}
% page break is correct when changing \refstepcounter to \stepcounter

\begin{document}

\fontsize{40pt}{50pt}\selectfont

\begin{question}111\end{question}
\begin{question}111\end{question}
\begin{question}111\end{question}

\begin{question}
If ... Then ... ( ).\par
(A) 11; (B) 22; (C) 33; (D) 44.
\end{question}

\begin{question}111\end{question}
\begin{question}111\end{question}
\begin{question}111\end{question}
\begin{question}111\end{question}
\begin{question}111\end{question}

\end{document}

The page break is correct when removing hyperref package, or changing \refstepcounter to \stepcounter. What is the problem with this example?

  • 1
    Thanks for posting a very clear MWE. I can reproduce the problem behavior. Fortunately, it disappears if one loads the geometry package as well. – Mico Oct 3 '13 at 11:49
  • @Mico geometry doesn't fix the issue it just changes the size a bit so makes the tipping point happen at a different place so makes the issue go from this example. – David Carlisle Oct 3 '13 at 12:12
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – jub0bs May 4 '14 at 12:34
8

Avoid putting specials in vmode

\newenvironment{question}{\par\mbox{}\refstepcounter{question}\thequestion. }{}

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.