When you open your PDF, you may find that page breaks occur in the middle of your code or visualizations. You can add custom page breaks to PDFs by inserting a line of code into an nteract markdown cell. This creates a page break between the notebook cell above and below it. Here are the steps for creating a page break:
- Select the M↓ symbol on the left (highlighted in the following screenshot) to create a new markdown cell:
- Click on the cell and add the following line of code:
<div style="page-break-after: always;"></div>
The preceding code creates a tag that tells nteract to place a page break after the preceding cell.
- As shown in the following screenshot, after adding the code, your page break cell will appear in your notebook as a blank bar:
- Export the notebook file as a PDF. Page 1 will contain notebook cell 1, while page 2 will start with notebook cell 2.
Go to https://stackoverflow.com/questions/22601053/pagebreak-in-markdown-while-creating-pdf to find a discussion on this topic.
You can add as many page breaks as you like throughout your document.