I am trying to print a notebook that begins with a lengthy piece of code that takes up almost an entire page. Because of my heading, it doesn't quite fit on Page 1, so Mathematica inserts a line break before the cell, leaving a ton of white space on Page 1, as shown below. Line break before cell

However, if I add a few lines, such that the input cell takes up more than one page, Mathematica is forced to insert a page break somewhere in the cell, so it does this:

Line break within cell

This looks much nicer. I want to tell Mathematica to insert page breaks whenever a cell runs off the bottom of the page, rather than only inserting page breaks within cells when it is absolutely necessary.

My attempt at a solution:

I've tried to modify the Printout stylesheet with

Cell[StyleData[All, "Printout"],  
ShowAutoStyles->True, ShowSyntaxStyles->True, Magnification->0.8, 

(The second line is for colored syntax printing, irrelevant to my question.) This doesn't seem to change the default behavior.

I also tried, as a less-than-elegant solution, manually inserting a page break in the input cell. This is not a satisfactory solution since it splits the cell into two input cells.

EDIT (working solution, but not ideal): I have at least figured out how to do this on a cell-by-cell basis.

  1. Highlight the cell that needs a page break.
  2. Press Ctrl+shift+O to open the Option Inspector, and in the dropdown menu for "Show option values", choose Selection.
  3. Navigate to Cell Options->Page Breaking and set the PageBreakWithin option to True. Click Apply and close the Option Inspector.

By choosing the location of the next page break strategically, I can then achieve the behavior I want. However, I would still be interested in a more general solution (rather than repeating the above steps over and over) if one exists.


1 Answer 1




to your stylesheet (Format -> Edit Stylesheet...)

  • $\begingroup$ Works like a charm, thank you!! $\endgroup$ Sep 12, 2013 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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