Start using Make to compile pdf with Pandoc
For a long time I have used a Pandoc command like this to convert Markdown files to pdf files:
$ pandoc -o essay.pdf \
--pdf-engine=xelatex metadata.yaml \
--lua-filter=/home/user/bin/smallscripts/count-para.lua \
--trace essay.md \
I first used to retrieve this command from history in Bash, then later saved it to an executable file.
I knew I could use Make, and wanted to learn how to use Make.
The other day I finally put together a first makefile:
TEX = pandoc
SRC = essay.md
FLAGS = --pdf-engine=xelatex metadata.yaml --lua-filter=/home/user/bin/smallscripts/count-para.lua --trace
essay.pdf : $(SRC)
$(TEX) -o $@ $< $(FLAGS)
.PHONY: clean
clean :
rm essay.pdf
Now I can run make to compile.
Appendix
For those who would like to see more.
- The
metadata.yamlfile in question looks like this:
---
geometry:
- margin=1in
documentclass: extarticle
fontsize: 14pt
linestretch: 1.25
...
- You can find the script
count-para.lua, which numbers paragraphs, there: https://git.yctct.com/small/tree/count-para.lua
Resources
The man page of Make.
personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki publishing make pandoc