# get the font files
sh GetSourceHanFont.sh
# build the docker
docker build -t your_pandoc .
# run it on your input file
docker run --rm -v `pwd`:/data -w /data your_pandoc -f markdown \
--template /template/eisvogel_zh.tex -t latex \
--metadata-file=/template/mydoc.yaml --pdf-engine=xelatex \
-o output.pdf input.md
Pandoc has an official Docker image pandoc/latex. I like to use the Eisvogel LaTeX template. Unfortunately, you cannot build PDFs from Markdown using this template with pandoc/latex. Some packages from TeX Live are missing.
Therefore, I created a Docker image based on pandoc/latex that can build PDFs using Eisvogel. You can find it on Docker Hub under rstropek/pandoc-latex.
The examples folder contains an example document (markdown content, YAML metadata) including the generated PDF document.
The following docker run
statement will generate mydoc.pdf from the markdown file mydoc.md with the YAML metadata in mydoc.yaml. Try to run the statement inside the example folder.
Several optional packages, mentioned by pandoc/latex, are preinstalled in the image.
That includes sectsty, for those who want to add line breaks before chapters without using the book property.
See this issue for more details.
Tested with Eisvogel LaTeX template 1.4.0.
docker run --rm \
-v `pwd`:/data \
-w /data \
rstropek/pandoc-latex \
-f markdown \
--template https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/5f740f8de0fb4c96dfb2772ef86e861fd3971654/eisvogel.tex \
-t latex \
-o mydoc.pdf \
--metadata-file=mydoc.yaml \
mydoc.md
docker run --rm ^
-v %cd%:/data ^
-w /data ^
rstropek/pandoc-latex ^
-f markdown ^
--template https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/5f740f8de0fb4c96dfb2772ef86e861fd3971654/eisvogel.tex ^
-t latex ^
-o mydoc.pdf ^
--metadata-file=mydoc.yaml ^
mydoc.md
# Use a significative tag
# (e.g. here, follow the version of pandoc/latex used as the basis in the Dockerfile).
docker build -t rstropek/pandoc-latex:2.9.1.1 .
Make sure you have BATS installed.
bats tests