Beamer 文档

概览

创建 Word 文档,你需要在 markdown 文件中的 front-matter 里声明 beamer_presentation 的输出类型:
你可以用 # 以及 ## 来分隔幻灯片(你还可以通过使用分隔符 (---) 来插入新的幻灯片)。
例如,下面是一个简单的例子:

  1. ---
  2. title: "Habits"
  3. author: John Doe
  4. date: March 22, 2005
  5. output: beamer_presentation
  6. ---
  7. # In the morning
  8. ## Getting up
  9. - Turn off alarm
  10. - Get out of bed
  11. ## Breakfast
  12. - Eat eggs
  13. - Drink coffee
  14. # In the evening
  15. ## Dinner
  16. - Eat spaghetti
  17. - Drink wine
  18. ----
  19. ![picture of spaghetti](images/spaghetti.jpg)
  20. ## Going to sleep
  21. - Get in bed
  22. - Count sheep

输出路径

你可以通过 path 来定义文档的输出路径。例如:

  1. ---
  2. title: "Habits"
  3. output:
  4. beamer_presentation:
  5. path: /Exports/Habits.pdf
  6. ---

如果 path 没有被定义,那么文档将会在相同的文件夹下生成。

Incremental Bullets

You can render bullets incrementally by adding the incremental option:

  1. ---
  2. output:
  3. beamer_presentation:
  4. incremental: true
  5. ---

If you want to render bullets incrementally for some slides but not others you can use this syntax:

  1. > - Eat eggs
  2. > - Drink coffee

Themes

You can specify Beamer themes using the theme, colortheme, and fonttheme options:

  1. ---
  2. output:
  3. beamer_presentation:
  4. theme: "AnnArbor"
  5. colortheme: "dolphin"
  6. fonttheme: "structurebold"
  7. ---

Table of Contents

The toc option specifies that a table of contents should be included at the beginning of the presentation (only level 1 headers will be included in the table of contents). For example:

  1. ---
  2. output:
  3. beamer_presentation:
  4. toc: true
  5. ---

Slide Level

The slide_level option defines the heading level that defines individual slides. By default this is the highest header level in the hierarchy that is followed immediately by content, and not another header, somewhere in the document. This default can be overridden by specifying an explicit slide_level:

  1. ---
  2. output:
  3. beamer_presentation:
  4. slide_level: 2
  5. ---

语法高亮

highlight 选项定义了高亮的样式。支持的样式包括 “default”,“tango”,“pygments”,“kate”,“monochrome”,“espresso”,“zenburn”,以及 “haddock” (设置 null 来禁用语法高亮):

例如:

  1. ---
  2. title: "Habits"
  3. output:
  4. beamer_presentation:
  5. highlight: tango
  6. ---

Pandoc Arguments

If there are pandoc features you want to use that lack equivalents in the YAML options described above you can still use them by passing custom pandoc_args. For example:

  1. ---
  2. title: "Habits"
  3. output:
  4. beamer_presentation:
  5. pandoc_args: [
  6. "--no-tex-ligatures"
  7. ]
  8. ---

Shared Options

If you want to specify a set of default options to be shared by multiple documents within a directory you can include a file named _output.yaml within the directory. Note that no YAML delimeters or enclosing output object are used in this file. For example:

_output.yaml

  1. beamer_presentation:
  2. toc: true

All documents located in the same directory as _output.yaml will inherit it’s options. Options defined explicitly within documents will override those specified in the shared options file.