I'm taking a CS class that has the following requirements for the homework (submitted as PDF output of a LaTeX document):

  • Each problem should be on its own page, with the heading "Problem n"
  • If a problem goes over one page, include any additional material for that problem on its own page at the end of the document, with the heading "Extra Space for Problem n"
  • Add notes: 'Continued on page x' at the bottom of the first page, and 'Continued from page y' on the extra page.

An example of a proper layout for a homework with 3 problems might be:

  1. Problem 1
  2. Problem 2
  3. Problem 3
  4. Extra Space for Problem 1
  5. Extra Space for Problem 3
  6. Extra Space for Problem 3

Is there any way to implement this automatically in LaTeX?

I've already created a document class with environments for the primary and extra page(s) of a problem, which automatically insert the proper heading, labels, notes.

However, it still requires I manage pagination manually. Is there a way to create an environment which will automatically re-order pages beyond the first at the end of the document, and add the proper headers and page references?

closed as unclear what you're asking by Joseph Wright Nov 1 '14 at 23:03

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What kind of content will be in the problems? Listings? Images? – Werner Sep 20 '13 at 0:01
  • Arbitrary content. It's for a CS theory class, so likely it will mainly be equations, algorithms, and regular text. However, images are possible as well. – int3h Sep 20 '13 at 4:02
  • I can change the order of output for the pages by using the atbegshi package: at the start of each question, I call \AtBeginShipoutNext with a hook which saves the shipout box to a list and clears it. Then at the end, I loop through that list and call \shipout on each. However, the page numbers in the footer are all wrong, and I don't know of an easy way to add a reference to the extra page number at the bottom of the first page, and the correct heading and original page number at the top of the extra pages. – int3h Sep 20 '13 at 5:25
  • I think it would be useful to see what you're tried so far. It may also shed some light on just how to fix your current problem, rather than re-inventing the wheel altogether. You can edit your question and add the content. – Werner Sep 20 '13 at 5:38