Literate.jl to PDF using Documenter.jl simple question

using Documenter, Literate

Literate.markdown("./litdocpdf.jl", "./md"; flavor = Literate.CommonMarkFlavor()) 
# CommonMarkFlavor because all we need is syntax highlighting
# making them @example blocks (via DocumenterFlavor) just needlessly complicates things

makedocs(; remotes = nothing, format = Documenter.LaTeX(), sitename = "PSM Test", pages = ["litdocpdf.md"], pagesonly = true, source="md")

This created this PDF from your code in the first post.

You can also add an authors kwarg to the makedocs call to add authors to the PDF title page. For more customization (eg. to remove the “table of contents”), I believe you’d have to add an assets folder under md and add a preamble.tex to it like this with your customizations.

(I also needed the Python package Pygments installed - I did it via pipx - and since this was a new-ish system without a full LaTeX installation, needed to add the newunicodechar, polyglossia, minted, tabulary, adjustbox, and tcolorbox packages for it to generate the PDF.)

2 Likes