如何在 markdown 中自定义 Beamer 输出的内容表?

如何在 markdown 中自定义 Beamer 输出的内容表?

我尝试将以下几行放在header-inludes:markdown 的 YAML 标题下。

- \setbeamertemplate{section in toc}[round]
- \setbeamerfont{section number projected}{size=\large}
- \setbeamercolor{section number projected}{bg=red,fg=green}

这不起作用并产生了这个错误:

Error producing PDF.
! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.

我的目标是设置自定义标题和目录的外观。

这是测试 markdown 文档:

---
title: Test beamer
date: April 2019
theme: Madrid
aspectratio: 169
header-includes:
  - \setbeamertemplate{section in toc}[round] 
  - \setbeamerfont{section number projected}{size=\large}
  - \setbeamercolor{section number projected}{bg=red,fg=green} 
---

\tableofcontents

# Head 1
## Slide title 1 
Some content

# Head 2
## Slide title 2
Some other content

以及 pandoc 命令:

pandoc -t beamer -o testbeamer.pdf testbeamer.md --slide-level=2

答案1

Pandoc 方括号转义,导致 LaTeX 出现错误。您可以从命令行添加 header-includes 或转义输入。注意,不要添加\tableofcontents到文档中,而是添加--table-of-contents到shell命令中:

---
title: Test beamer
date: April 2019
theme: Madrid
aspectratio: 169
header-includes: |
  `\setbeamertemplate{section in toc}[round]`{=latex}
  \setbeamerfont{section number projected}{size=\large}
  \setbeamercolor{section number projected}{bg=red,fg=green} 
---

# Head 1
## Slide title 1 
Some content

# Head 2
## Slide title 2
Some other content

相关内容