0
$\begingroup$

I'm doing some calculations on a notebook, and then I print the results. All my code is written in a single cell. Later, I save the notebook as a PDF file.

I want the results to be grouped correctly, each on a different page. Is there a way to print a page-break?

I want to do this in my code, and then to get every calculation in a different page. I searched the help, but I only found menu options to manually insert page break.

I've also seen that I could CreateDocument and maybe manipulate that, but I prefer doing it straight on the notebook I'm working on.

thanks

$\endgroup$
2
$\begingroup$

To insert a pagebreak after each output cell, you can add CellPrint@Cell["", "PageBreak"]; after your Print statements as shown below:

Print@Sin@x;
CellPrint@Cell["", "PageBreak"]
Print@Cos@x;

Alternatively, you could redefine the Print function locally for your whole code block as follows:

With[{Print = (Print@#; CellPrint@Cell["", "PageBreak"])&},
...your code...
]

"Example"

$\endgroup$

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.