Skip to content

rstropek/pandoc-latex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pandoc LaTeX with Eisvogel

Docker Image Version (latest semver)

Introduction

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.

Examples

The examples folder contains an example document (markdown content, YAML metadata) including the generated PDF document.

Usage

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.

Supported Versions

Tested with Eisvogel LaTeX template 2.4.0.

Linux

docker run --rm \
    -v `pwd`:/data \
    -w /data \
    rstropek/pandoc-latex \
    -f markdown \
    --template https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/v2.4.0/eisvogel.tex \
    -t latex \
    -o mydoc.pdf \
    --metadata-file=mydoc.yaml \
    mydoc.md

Windows

docker run --rm ^
    -v %cd%:/data ^
    -w /data ^
    rstropek/pandoc-latex ^
    -f markdown ^
    --template https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/v2.4.0/eisvogel.tex ^
    -t latex ^
    -o mydoc.pdf ^
    --metadata-file=mydoc.yaml ^
    mydoc.md

Development

Build

# 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:latest .

Tests

Make sure you have BATS installed.

bats tests

Tips and Tricks

Manual Page Breaks

To insert manual page breaks, download pagebreak.lua. In the docker run statement shown above, you can reference it using the --lua-filter pagebreak.lua switch (e.g. docker run ... rstropek/pandoc-latex -f markdown ... -t latex --lua-filter pagebreak.lua ...). Once you did that, you can add page breaks in your .md files using \newpage. Example:

# Chapter 1

Some text goes here.

\newpage

# Chapter 2

Additional text goes here.

References

You can read about citations in the Pandoc documentation. Here is a checklist for what you have to do:

references:
- title: Azure Homepage
  container-title: Microsoft Website
  id: Azure-Homepage
  author: Microsoft
  URL: https://azure.microsoft.com
  type: webpage
  • Add references to markdown (e.g. Bla bla [see @Azure-Homepage]. Bla bla.).
  • Add the following options to the call to Pandoc: --filter pandoc-citeproc --bibliography=bib.yaml --csl=https://www.zotero.org/styles/ieee

About

Extended version of pandoc/latex, can build document with Eisvogel LaTeX template

Resources

License

Stars

Watchers

Forks

Packages

No packages published