fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.96k stars 286 forks source link

🖨️ Some PDF layout improvements #2738

Closed fonsp closed 10 months ago

fonsp commented 10 months ago

Header positions

We now avoid a widow header, so there is a higher likelihood that a header will appear on the same page as the content it is a header to:

Screenshots are before & after

image

The level 1 header will always create a new page

image

Other page break changes

The <br> or --- horizontal rule will now act like a page break when creating a PDF

image

Before this PR, Pluto avoids all page breaks inside of a pluto-cell. I.e. if a cell (content + code (if not folded)) needs to be fragmented between pages, it will be moved to the next page.

This PR adds an exception for "prose cells": cells that contain mostly text. This means that cells that just contain a couple paragraphs are allowed to break inside. Here, you expect breaks inside, and it creates a less fragmented document overall.

image

Avoid empty final page

Made some changes that were sometimes causing an extra empty page at the end of the document.

image

Full before/after comparisons

I printed all the featured notebooks before and after:

before.zip

after.zip

github-actions[bot] commented 10 months ago

Try this Pull Request!

Open Julia and type:

  julia> import Pkg
  julia> Pkg.activate(temp=true)
  julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="print-stylesheet-improvements")
  julia> using Pluto