Switch rendering to LaTeX, which is extensible and beautiful.

This commit is contained in:
Nicholas Warzin 2023-12-18 16:51:20 -05:00
parent f8e30e28cf
commit bbc4d0d38d

View File

@ -2,19 +2,26 @@
For documents I intend to distribute (such as this CV), I typically watch markdown files for changes in a couple tmux panes, rendering them to PDF. If the resulting CV is a bit staid, it makes up for it with version control on the CV's contents, and a good workflow. I haven't really automated it beyond this yet.
Pandoc uses LaTeX as an intermediate rendering step, and most of the variables passed to Pandoc below are for LaTeX's benefit: fonts, geometry, etc.
## Prerequisites
- Pandoc (https://github.com/jgm/pandoc)
- A CSS file used by Pandoc for rendering the PDF, in this case something approximating GitHub's readme style (https://github.com/sindresorhus/github-markdown-css, or some such)
- entr (https://github.com/eradman/entr), or some inotify-compatible alternative
- LaTeX (https://www.latex-project.org/), via the [MacTeX](https://www.tug.org/mactex/) distro
## Command
```bash
echo README.md | entr -s 'pandoc -f gfm -t html --metadata pagetitle="CV, Nicholas Warzin, 2023" --css github.css README.md -o cv_nicholas-warzin_2023.pdf'
pandoc \
-f gfm \
-V fontfamily=merriweather \
-V geometry:margin=0.8in \
-V pagestyle:empty \
-V fontfamilyoptions:light \
-V linestretch:1.1 \
README.md \
-o cv_nicholas-warzin_2023.pdf
```
### Explanation
- `-f gfm` Assume README.md is written in GitHub-flavoured Markdown, ensuring consistent rendering as a PDF and as a repository's README.md
- `-t html` Convert to PDF using HTML as the intermediate format (versus, say, LaTeX)
- `--metadata pagetitle="..."` Give the document a readable page title
- `--css github.css` Render the document like a GitHub readme
- `-V pagestyle:empty` Drop page numbers