Coder Social home page Coder Social logo

r2binx / pandoc-latex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rstropek/pandoc-latex

0.0 0.0 0.0 284 KB

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

License: MIT License

Dockerfile 26.28% Shell 73.72%

pandoc-latex's Introduction

Pandoc LaTeX with Eisvogel

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 1.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/v1.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/v1.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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.