pandoc-latex-template

WandmalfarbeBSD-3-Clause更新放缓 有专家点评

用 Pandoc 把 Markdown 转成排版精美的 PDF 或 LaTeX 的模板,基于 KOMA-Script,开箱即用,省去自己调 LaTeX 样式的麻烦。

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.

v3.5.1发布于 2026-07-04 13:55 UTC7,303star +1 / 7 天1,021fork同步于 2026-11-11 05:31 UTC

专家点评

上手难度:进阶更新于 2026-11-11

给 pandoc 的 Markdown→PDF 输出套一层 KOMA-Script 排版,替掉手写 LaTeX 导言区

适用场景

  • 写技术讲义或课程笔记:正文用 Markdown 维护,靠 YAML 元数据控制标题页、页眉页脚和代码高亮,不用为每篇文档重复搭 LaTeX 骨架;换成纯 LaTeX 模板则每次改版式都要动 .tex
  • 需要同时产出 PDF 和 LaTeX 源:同一份 md 加 -t latex 就能拿到可继续手改的 .tex,交给期刊模板或合作者;直接用 HTML→PDF 工具链拿不到这一层
  • 内部文档/报告的批量生成:CI 里跑 pandoc + 模板,输出风格统一,比维护 Word 模板再人工导出可控
  • 幻灯片:eisvogel.beamer 让同一套 Markdown 出 beamer PDF,省掉单独维护一套幻灯片源

踩坑

  • 模板文件不在仓库里,得从 release 下载 ZIP 放进 pandoc 模板目录;直接 clone 仓库跑命令会报找不到模板,这是第一次上手最容易卡住的地方
  • 字体覆盖是反复被提的问题:issue 里有 Source Sans Pro 缺字形(emoji 等 unicode 字符)和默认字体族无法覆盖的反馈,文档里混排非拉丁字符或想换字体时要预留调试时间
  • titlepage-logo 的路径按执行目录解析,--resource-path 对它不生效;在 CI 或从子目录调用 pandoc 时 logo 会静默丢失,需要显式 cd 或写绝对路径

同类对比

要更轻、不依赖本地 LaTeX 的可以看 pandoc 自带的 HTML→PDF 路线(wkhtmltopdf/weasyprint 类),代价是排版精细度和分页控制差一截;需要深度定制版式时直接写自己的 .latex 模板比改 Eisvogel 更省事。

怎么上手

由 README 提炼,执行前请确认
pandoc example.md -o example.pdf --from markdown --template eisvogel --syntax-highlighting idiomatic
硬件要求按 README 说明

README 未说明硬件要求,仅需安装 pandoc 与 LaTeX 发行版,或改用 Docker 镜像 pandoc/extra

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 Eisvogel 模板把 Markdown 转成排版干净的 PDF 或 LaTeX,适合讲义和计算机科学文档

用 Pandoc 把 Markdown 转成排版精美的 PDF 或 LaTeX 的模板,基于 KOMA-Script,开箱即用,省去自己调 LaTeX 样式的麻烦。

核心能力

  • 提供 eisvogel.latex 与 eisvogel.beamer 两套模板
  • 支持自定义标题页颜色、背景图和 logo
  • 可配置页眉页脚、水印与目录分页
  • 通过 YAML 元数据块控制文档外观
  • 兼容 pandoc 3,支持代码高亮与 listings

容易踩的坑

模板文件不在 Git 仓库中,需从 release 页面下载 ZIP 并放入 pandoc 模板目录;需安装完整 texlive 或手动补齐 footnotebackref 等 LaTeX 包;titlepage-logo 路径相对执行目录,--resource-path 对其无效

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v3.5.1
  1. v3.5.1Eisvogel (Version 3.5.1)最新正式版2026-07-04 · 2026-07-04 13:55 UTC
    • fix: any custom mainfont (XeLaTeX or LuaLaTeX) gets incorrectly overridden by Source Sans (#459, dm5n)
  2. v3.5.0Eisvogel (Version 3.5.0)2026-06-28 · 2026-06-28 17:04 UTC
    查看更新说明
    • fix: change SEDOPTION in release.sh to index (#409, #457, SandyJackson)
    • feat: add example beamer-theme-moloch
    • chore: migrate from sourcesanspro to sourcesans
      • remove XeLaTeX workaround for straight quotes (#454, #79)
      • remove if else construct for XeLaTeX workaround
    • feat: allow users to customize paragraph indentation (#453, Jack77793)
  3. v3.4.0Eisvogel (Version 3.4.0)2026-02-08 · 2026-02-08 19:24 UTC
    查看更新说明
    • feat: merge changes from the pandoc default LaTeX template from version 3.9 (e5102b4).
    • ci: use pandoc 3.9 for CI build
    • docs: Add example github-alerts that demonstrates how GitHub-style Markdown alerts are supported with the help of a small Lua filter.
    • feat: replace deprecated option --listings with --syntax-highlighting idiomatic in examples and documentation
    • feat: replace deprecated option --highlight-style with --syntax-highlighting in examples and documentation
    • fix: remove unused and outdated docs folder
    • fix: remove unused tests folder
  4. v3.3.0Eisvogel (Version 3.3.0)2025-11-22 · 2025-11-22 15:08 UTC
    查看更新说明
    • feat: merge changes from the pandoc default LaTeX template from version 3.8.2.1 (8baa07f).
      • This resolves an incompatibility between Eisvogel and pandoc >= 3.8.2.1 because of the introduction of \newcounter{none} in jgm/pandoc#11201
  5. v3.2.1Eisvogel (Version 3.2.1)2025-09-20 · 2025-09-20 10:55 UTC
    查看更新说明
    • docs: add three examples for changing the document font
      • font-emoji-noto-color-emoji: renders emojis with Noto Color Emoji
      • font-emoji-openmoji: renders emojis with OpenMoji
      • font-unicode-font-fallback: renders missing glyphs with various Noto fonts
    • ci: install luatex for rendering examples with --pdf-engine lualatex
    • ci: allow (optional) example document creation with Java
    • fix: apply consistent heading colors. Previously, only the first-level heading color (\section) was changed to #282828 (RGB 40, 40, 40). Now all the headings (\chapter, \part, \subsubsection, etc.) are changed, even when using book: true.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Eisvogel

    A clean pandoc LaTeX template to convert your markdown files to PDF or LaTeX. It is designed for lecture notes and exercises with a focus on computer science. The template is compatible with pandoc 3.

    Preview

    A custom title pageA basic example page
    A custom title pageA basic example page

    Installation

    1. Install pandoc from https://pandoc.org/. You also need to install LaTeX.

    2. Download the latest version of the Eisvogel template from the release page.

    3. Extract the downloaded ZIP archive and open the folder.

    4. Move the two template files eisvogel.latex and eisvogel.beamer to your pandoc templates folder. The location of the templates folder depends on your operating system:

      • Unix, Linux, macOS: /Users/USERNAME/.local/share/pandoc/templates/ or /Users/USERNAME/.pandoc/templates/
      • Windows Vista or later: C:\Users\USERNAME\AppData\Roaming\pandoc\templates\

      If there are no folders called templates or pandoc you need to create them and put the two template files inside. You can find the default user data directory on your system by looking at the output of pandoc --version.

    Eisvogel versions

    The Eisvogel template is distributed in three different versions inside the compressed archives:

    1. eisvogel.latex

      A standalone single file version for normal documents (articles, books, notes). The LaTeX and beamer templates used to be in a single file but are now separated.

      [!IMPORTANT]
      This file is NOT present in this Git repository and has to be obtained from a released version of the template.

    2. eisvogel.beamer

      A standalone single file version for use with beamer to produce slides. The LaTeX and beamer templates used to be in a single file but are now separated.

      [!IMPORTANT]
      This file is NOT present in this Git repository and has to be obtained from a released version of the template.

    3. template-multi-file

      This folder contains the original template (LaTeX and Beamer), split into several files. At release, the one-file versions are generated from this folder.

    Docker image

    Alternatively, if you don't want to install LaTeX, you can use the Docker image named pandoc/extra. The image contains pandoc, LaTeX and a curated selection of components such as the eisvogel template, pandoc filters and open source fonts. A common use of the image looks like this (line breaks for readability):

    docker run --rm \
           --volume "$(pwd):/data" \
           --user $(id -u):$(id -g) \
           pandoc/extra example.md -o example.pdf --template eisvogel --syntax-highlighting idiomatic
    

    For frequent command line use, you can define the following shell alias:

    alias pandock='docker run --rm -v "$(pwd):/data" -u $(id -u):$(id -g) pandoc/extra'
    

    The example invocation with Docker from above now looks like this:

    pandock example.md -o example.pdf --template eisvogel --syntax-highlighting idiomatic
    

    Usage

    1. Open the terminal and navigate to the folder where your markdown file is located.

    2. Execute the following command

      pandoc example.md -o example.pdf --from markdown --template eisvogel --syntax-highlighting idiomatic
      

      where example.md is the markdown file you want to convert to PDF.

    In order to have nice headers and footers you need to supply metadata to your document. You can do that with a YAML metadata block at the top of your markdown document (see the example markdown file). Your markdown document may look like the following:

    ---
    title: "The Document Title"
    author: [Example Author, Another Author]
    date: "2017-02-20"
    keywords: [Markdown, Example]
    ...
    
    Here is the actual document text...
    

    Custom Template Variables

    This template defines some new variables to control the appearance of the resulting PDF document. The existing template variables from pandoc are all supported and their documentation can be found in the pandoc manual.

    • titlepage (defaults to false)

      turns on the title page when true

    • titlepage-color

      the background color of the title page. The color value must be given as an HTML hex color like D8DE2C without the leading number sign (#). When specifying the color in YAML, it is advisable to enclose it in quotes like so titlepage-color: "D8DE2C" to avoid the truncation of the color (e.g. 000000 becoming 0).

    • titlepage-text-color (defaults to 5F5F5F)

      the text color of the title page

    • titlepage-rule-color (defaults to 435488)

      the color of the rule on the top of the title page

    • titlepage-rule-height (defaults to 4)

      the height of the rule on the top of the title page (in points)

    • titlepage-logo

      path to an image that will be displayed on the title page. The path is always relative to where pandoc is executed. The option --resource-path has no effect.

    • titlepage-background

      the path to a background image for the title page. The background image is scaled to cover the entire page. In the examples folder under titlepage-background are a few example background images.

    • page-background

      the path to a background image for any page. The background image is scaled to cover the entire page. In the examples folder under page-background are a few example background images.

    • page-background-opacity (defaults to 0.2)

      the background image opacity

    • caption-justification (defaults to raggedright)

      justification setting for captions (uses the justification parameter of the caption package)

    • toc-own-page (defaults to false)

      begin new page after table of contents, when true

    • listings-disable-line-numbers (defaults to false)

      disables line numbers for all listings

    • listings-no-page-break (defaults to false)

      avoid page break inside listings

    • disable-header-and-footer (default to false)

      disables the header and footer completely on all pages

    • header-left (defaults to the title)

      the text on the left side of the header

    • header-center

      the text in the center of the header

    • header-right (defaults to the date)

      the text on the right side of the header

    • footer-left (defaults to the author)

      the text on the left side of the footer

    • footer-center

      the text in the center of the footer

    • footer-right (defaults to the page number)

      the text on the right side of the footer

    • footnotes-pretty (defaults to false)

      prettifies formatting of footnotes (requires package footmisc)

    • footnotes-disable-backlinks (defaults to false)

      disables making the reference from the footnote at the bottom of the page into a link back to the occurrence of the footnote in the main text (enabling requires package footnotebackref).

    • book (defaults to false)

      typeset as book

    • logo-width (defaults to 35mm)

      the width of the logo. One needs to specify the width with a (TeX) unit e.g. 100pt or 35mm. The following units can be used:

      • pt: Point
      • pc: pica (12 pt)
      • in: inch (72.27 pt)
      • bp: Big point (72 bp = 1 in)
      • cm: Centimeter
      • mm: Millimeter
      • dd: Didot point
      • cc: cicero (12 dd)
      • sp: Scaled point (65,536 sp = 1 pt)
      • ex: Nominal x-height
      • em: Nominal m-width
      • px: Pixel (only for pdfTeX and LuaTeX) The dimension given to the \pdfpxdimen primitive; default value is 1 bp, corresponding to a pixel density of 72 dpi.

      A visual overview of the length units is available at https://github.com/tweh/tex-units.

    • first-chapter (defaults to 1)

      if typesetting a book with chapter numbers, specifies the number that will be assigned to the first chapter

    • float-placement-figure (defaults to H)

      Reset the default placement specifier for figure environments to the supplied value e.g. htbp. The available specifiers are listed below. The first four placement specifiers can be combined.

      1. h: Place the float here, i.e., approximately at the same point it occurs in the source text.
      2. t: Place the float at the top of the page.
      3. b: Place the float at the bottom of the page.
      4. p: Place the float on the next page that will contain only floats like figures and tables.
      5. H: Place the float HERE (exactly where it occurs in the source text). The H specifier is provided by the float package and may not be used in conjunction with any other placement specifiers.
    • table-use-row-colors (defaults to false)

      enables row colors for tables. The default value is false because the coloring extends beyond the edge of the table and there is currently no way to change that.

    • code-block-font-size (defaults to \small)

      LaTeX command to change the font size for code blocks. The available values are \tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge and \Huge. This option will change the font size for default code blocks using the verbatim environment and for code blocks generated with listings.

    • watermark (defaults to none)

      Displays the text provided as a watermark on each page. Useful to express that a document is work in progress, a draft, or that the document is confidential.

    Required LaTeX Packages

    LaTeX manages addons and additional functionality in so-called packages. You might get the following error when compiling a document with the Eisvogel template:

    ! LaTeX Error: File `footnotebackref.sty' not found.
    
    Type X to quit or <RETURN> to proceed,
    or enter new name. (Default extension: sty)
    
    Enter file name:
    ! Emergency stop.
    <read *>
    

    LaTeX informs you that the additional package footnotebackref is required to render the document.

    Texlive

    Eisvogel requires a full texlive distribution that can be installed by running apt-get install texlive-full in the terminal. Because texlive-full is very large (about 5 Gigabytes) you can also install the smaller texlive bundles and add any missing packages manually.

    A smaller texlive bundle is texlive-latex-extra. With texlive-latex-extra you also need to install these packages manually:

    adjustbox babel-german background bidi collectbox csquotes everypage filehook
    footmisc footnotebackref framed fvextra letltxmacro ly1 mdframed mweights
    needspace pagecolor sourcecodepro sourcesans titling ucharcat
    unicode-math upquote xecjk xurl zref draftwatermark
    

    Install them with the following command:

    tlmgr install soul adjustbox babel-german background bidi collectbox csquotes everypage filehook footmisc footnotebackref framed fvextra letltxmacro ly1 mdframed mweights needspace pagecolor sourcecodepro sourcesans titling ucharcat unicode-math upquote xecjk xurl zref draftwatermark
    

    Additional information about the different texlive packages can be found at this TeX-StackExchange answer: https://tex.stackexchange.com/a/504566

    MiKTeX

    If you don't want to install all missing packages manually, MiKTeX might be an alternative.

    MiKTeX has the ability to automatically install missing packages. You can turn this feature on or off. And you can let MiKTeX ask you each time a package has to be installed:

    • Click Settings to navigate to the settings page.
    • Click the General tab.
    • Click one of the radio buttons:
      • Ask me
      • Always install missing packages on-the-fly
      • Never install missing packages on-the-fly

    Examples

    Numbered Sections

    For PDFs with numbered sections use the --number-sections or -N option.

    pandoc example.md -o example.pdf --template eisvogel --number-sections
    

    Syntax Highlighting with Listings

    You can get syntax highlighting of delimited code blocks by using the LaTeX package listings with the option --syntax-highlighting idiomatic. This example will produce the same syntax highlighting as in the example PDF.

    pandoc example.md -o example.pdf --template eisvogel --syntax-highlighting idiomatic
    

    Syntax Highlighting Without Listings

    The following examples show syntax highlighting of delimited code blocks without using listings. To see a list of all the supported highlight styles, type pandoc --list-highlight-styles.

    pandoc example.md -o example.pdf --template eisvogel --syntax-highlighting pygments
    
    pandoc example.md -o example.pdf --template eisvogel --syntax-highlighting kate
    
    pandoc example.md -o example.pdf --template eisvogel --syntax-highlighting espresso
    
    pandoc example.md -o example.pdf --template eisvogel --syntax-highlighting tango
    

    Standalone LaTeX Document

    To produce a standalone LaTeX document for compiling with any LaTeX editor use .tex as an output file extension.

    pandoc example.md -o example.tex --template eisvogel
    

    Changing the Document Language

    The default language of this template is American English. The lang variable identifies the main language of the document, using a code according to BCP 47 (e.g. en or en-GB). For an incomplete list of the supported language codes see the documentation for the hyph-utf8 package (Section 2). The following example changes the language to British English:

    pandoc example.md -o example.pdf --template eisvogel -V lang=en-GB
    

    The following example changes the language to German:

    pandoc example.md -o example.pdf --template eisvogel -V lang=de
    

    Typesetting a Book

    To typeset a book supply the template variable -V book from the command line or via book: true in the metadata.

    To get the correct chapter headings you need to tell pandoc that it should convert first level headings (indicated by one # in markdown) to chapters with the command line option --top-level-division=chapter. Chapter numbers start at 1. If you need to change that, specify first-chapter in the template variables.

    There will be one blank page before each chapter because the template is two-sided per default. So if you plan to publish your book as a PDF and don’t need a blank page you should add the class option onesided which can be done by supplying a template variable -V classoption=oneside.

    Example Images

    A green title pageA background image on the title page
    A green title pageA background image on the title page
    images and tablesCode blocks styled without listings
    images and tablesCode blocks styled without listings
    A bookCode blocks styled with listings
    A bookCode blocks styled with listings
    A background images on all pagesCJK Support (when using XeLaTeX)
    A background images on all pagesCJK Support (when using XeLaTeX)

    Common Errors / Issues

    The following section lists common errors and their solutions when using the Eisvogel template.

    LaTeX Errors Missing endcsname inserted or File x not found when using titlepage-background, logo, or titlepage-logo.

    Error producing PDF.
    ! Missing endcsname inserted.
    <to be read again>
                       protect
    
    Error producing PDF.
    ! Package pdftex.def Error: File `logo\T1\textunderscoreimage.pdf' not found:
    using draft setting.
    
    See the pdftex.def package documentation for explanation.
    Type  H <return>  for immediate help.
    

    These errors occur when one includes a background image on the title page or a logo that has an underscore (_) in the filename.

    A quick fix would be to replace all underscores in the filename of the image with a hyphen (-). If the background image is specified in your YAML front matter like so,

    titlepage-background: "background_image.pdf"
    

    you can advise pandoc to interpret this as LaTeX and include it in the document without parsing.

    titlepage-background: "`background_image.pdf`{=latex}"
    

    The same fix can be used for the logo image as well:

    logo: "`logo_image.pdf`{=latex}"
    

    Corresponding issues:

    LaTeX Error Missing \begin{document}

    ! LaTeX Error: Missing \begin{document}.
    
    See the LaTeX manual or LaTeX Companion for explanation.
    Type  H <return>  for immediate help.
     ...
    
    l.7 <
         !DOCTYPE html>
    !  ==> Fatal error occurred, no output PDF file produced!
    

    This error indicates that you try to use some text file for conversion that is not the Eisvogel template. Please download the latest Eisvogel template from the releases page and start the conversion again.

    LaTeX Error auto expansion is only possible with scalable fonts

    Error producing PDF.
    ! pdfTeX error (font expansion): auto expansion is only possible with scalable
    fonts.
    \AtBegShi@Output ...ipout \box \AtBeginShipoutBox
                                                      \fi \fi
    l.643 \begin{lstlisting}
    

    This error likely occurs on Windows with MiKTeX installed. StackOverflow user Krebto provided the following fix:

    To solve the problem navigate to C:\Program Files\MiKTeX 2.9\miktex\bin\x64 and run updmap.exe. The program may seem as it hangs for a while, but its probably because it tries to update the whole font tree. This solved the problem for me. After re-compiling everything should work fine.

    Corresponding issue:

    LaTeX Error cannot find image file

    Error producing PDF.
    ! error:  (file "/tmp/tex2pdf.-be734e802ef6d0c3/""fdcfc29edcf252186f1b0a52f18f50
    43abaeb2d0".png) (pdf backend): cannot find image file '"/tmp/tex2pdf.-be734e802
    ef6d0c3/""fdcfc29edcf252186f1b0a52f18f5043abaeb2d0".png'
    !  ==> Fatal error occurred, no output PDF file produced!
    

    In general this error means that LaTeX is unable to find the included image file. Please check all image references and file names for correctness.

    This error also occurs if you use an old version of Eisvogel with the package grffile and have an old LaTeX distribution installed. Please update Eisvogel and your LaTeX distribution.

    Corresponding issues:

    Credits

    License

    This project is open source licensed under the BSD 3-Clause License. Please see the LICENSE file for more information.