Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to typeset two chunks of text (a problem statement and solution) next to each other, but I don't want the problem to be the last thing on a page and the solution to be the first thing on the next page. Is there a way to get LaTeX to try to keep them together if they occur at a page boundary — for example, by pushing a few lines of the problem onto the solution page, or vice versa? (Each paragraph/section can be broken individually, but I would like the boundary to be on one page.)

share|improve this question
    
put \nopagebreak between them. (It might needs some other changes as well, especially if you are using \flushbottom rather than \raggedbottom, but start there:-) –  David Carlisle Oct 18 '12 at 18:36
1  
Maybe this one could help you. –  Benedikt Bauer Oct 18 '12 at 18:36
    
@DavidCarlisle: Oh, c'mon! That's too simple! ;-) –  Benedikt Bauer Oct 18 '12 at 18:37
    
Please add a minimal working example (MWE) that illustrates your problem. It would be easier to help you that way. –  Werner Oct 18 '12 at 18:53
    
This mostly depends on how you define the logical units for problem and solution. –  egreg Oct 18 '12 at 19:33

1 Answer 1

There also is the samepage environment. I would try the following:

Random sentence of the problem. Random sentence of the problem. Random
sentence of the problem.

  \begin{samepage}
  One of the last sentences of the problem. The last sentences of the
  problem.

  The first sentence of the solution. Another sentence of the solution.
  \end{samepage}

Random sentence of the solution. Random sentence of the solution. Random
sentence of the solution.

Maybe that's good enough for you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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