mbutterick / pollen

book-publishing system [mirror of main repo at https://git.matthewbutterick.com/mbutterick/pollen]
https://git.matthewbutterick.com/mbutterick/pollen
MIT License
1.19k stars 64 forks source link

Add LaTeX environments for custom Scribble tags (fixes #231) #232

Closed otherjoel closed 4 years ago

otherjoel commented 4 years ago

Doing raco setup --doc-pdf x pollen no longer fails, and it produces a PDF file that is…of normal quality for Scribble documents.

Besides becoming CSS classes, the names of custom Scribble styles are also reused as names of LaTeX macros. The only legal characters in LaTeX macro names are letters; no numbers or punctuation allowed. So I had to change some of the names, and change the CSS to match.

That 🎸 emoji: pdflatex is famously bad at Unicode, and chokes on the 🎸 used in setup.scrbl. The most common advice is to use a newer engine like xelatex instead (not on the table here). Failing that, it is supposed to be possible to substitute a vector graphic for particular characters, like so:

\DeclareUnicodeCharacter{1F3B8}{\includegraphics{unicode1febb.eps}}

But pdflatex (running from inside raco setup) always complained of not being able to find the .eps file I supplied (same with SVG, and PDF). So instead I substitute ∇ (\nabla) for 🎸 in the PDF.

mbutterick commented 4 years ago

Thanks @otherjoel. This would’ve hopeless for me.