• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

rstropek/pandoc-latex: Extended version of pandoc/latex, can build document with ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

rstropek/pandoc-latex

开源软件地址(OpenSource Url):

https://github.com/rstropek/pandoc-latex

开源编程语言(OpenSource Language):

Shell 69.3%

开源软件介绍(OpenSource Introduction):

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 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/v2.0.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.0.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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap