I'm working on a homework set, and one of my answers to a multi-part question has become very long. I've been keen on keeping problems and solutions as much on the same page as possible, and my current solution (of putting both the question and its solution in a minipage) turns out to be rather less than optimal, as it forces everything too strictly to be on the same page, and moves a question to its own page even when it's not strictly necessary.

What I'd like is something like the following:

1. Question
  a) Subquestion #1
---page break here if necessary---
  b) Subquestion #2
---page break here if necessary---
2. Question

I've been doing minipage around the whole question/subquestion/solution block, but this obviously forces everything onto the same page. I've played around with samepage and nobreak and nopagebreak and even putting each individual block described above in its own minipage, which seems to really mess up enumeration and all sorts of spacing. nopagebreak seems to not want to work at all for some reason for me.

What's a good way to a do this? Thanks in advance, and please let me know if I've been vague at all.

  • 1
    Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages. In this case it would go a long way toward explaining the enumeration problems you mention as I was about to recommend that you put each subsection in a minipage. Sep 10, 2012 at 1:11
  • Actually, it turns out my use of a description list instead of a more appropriate class was ruining horizontal alignment. Sorry, and thanks for your help. Sep 10, 2012 at 3:57
  • 2
    As it seems you found a way to solve your problem, it would be really nice if you could share that solution with us, so that others who come across the same problem may find help more easily. Answering your own question is desired on this site!
    – bodo
    Sep 10, 2012 at 6:21

1 Answer 1


From your problem description I assume that

  • what you are interested in is breaking more or less only after solutions
  • you will accept varying white space at the bottom of the pages

In that case my suggestion would be to use \filbreak which is a plain TeX command that is also available in LaTeX. Its definition is (roughly)


This means: fill the remainder of the page with whitespace and consider this solution a "page good break point" (negative penalty). But then back up to the current point and continue typesetting. So this will be taken unless a better break comes along later. Because of the negative penalty (in addition to the resulting page having optional badness) not many natural breakpoints can compete.

Placing such a command in every place that are good candidate for pagebreaks will give you the desired result and it could even easily added to some environments that suround your questions and answers.

There is however one exeption: if one question+solution is actually more than a page then it doesn't really make sense to start it on a new page and leave the previous half empty. But the above solution would do this, because it sees the first \filbreak and then nothing that is a better pagebreak and therefore eventually backs up to this breakpoint. If that happens then the answer is to manually correct that page by taking out the previous \filbreak or by adding one explicit page break in addition.

  • This is fantastic! Thanks so much, I'd never even heard of \filbreak. Sep 20, 2012 at 1:28

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.