本文描述利用 pandoc 产生成 beamer pdf 格式的幻灯版. 生成的 pdf
文件在浏览器中打开时幻灯片的控制效果非常好. 可选的, 也可以在, 也可以在 pdf
阅读器中打开, 然后使用 “放映” 模式进行播放.
使用的命令:
#! /bin/sh
# 模板路径
template_path=~/apps/bin/pandoc-templates
cmd="pandoc -t beamer \
-V theme:Warsaw -V fonttheme:serif \
-V CJKmainfont=\"SimSun\" \
-V papersize=a4 \
--latex-engine=xelatex \
--template=$template_path/default.beamer \
输入文件.pandoc -o 输出文件.ppt.pdf"
`$cmd`
更多的关于可调整的参数信息 (以 -V
传递给 pandoc) 可以参考 beamer.
关于各种可用模块, 也参考 beamer.
插入图片时
\begin{center}
\includegraphics[width=10cm, height=5cm]{./images/data_bus.png}
\par
图 2: DDS 基于软总线的应用集成
\end{center}
通过代码 (比如 plantuml, graphviz) 生成图片嵌入时, 也使用上面方式
--top-level-division=[default|section|chapter|part]
在输出为 Latex, ConTeXt, DocBook, TEI 时, 将顶级 header 当作分割 (division)
类型. 分级 (hierarchy) 顺序为 part, chapter, section; 所有的 header
都会被移动以使顶级 header 成为指定的类型, 缺省为 section. 若 LaTeX 的文档的类别 (class) 设置为 report, book 或 memoier, 那么会使用 section 进行分割.
若输出为 beamer, 指定为 chapter 或 part 会使项级 headers 成为 \part{...}
,
而二级 header 仍然保持缺省的类型.
--slide-level=NUMBER
根据指定的 header 级别来创建幻灯片. 在此级别以上的 header 用来将幻灯片分割为
section, 在此级别以下的 header 会创建一个 subhead. 缺省值会根据文档内容来设置
(按经验是 1).
--template
指定模板, 缺省为 default.beamer.
institute
指定机构. 这是对 pandoc title block 的补充.
theme, colorlinks theme, fonttheme, innertheme, outertheme
用于 LaTeX beamer 文档的主题. 如 -V theme:Warsaw
.
themeoptions
用于 LaTeX beamer 文档的主题的选项列表.
navigation
控制 beamer 文档的导航图标 (缺省为空, 表示没有导航图标). 可取的值为 frame,
vertical, horizontal.
section-titles
为每个 section 启用 “标题页” (title page), 缺省为 true.
beamerarticle
若为 true, 会载入 beamerarticle 包, 用于从 beamer 幻灯片产生文章.
colorlinks
为链接文本加色. 若设置了 citecolor, urlcolor, or toccolor, 那么此值自动为 true.
linkcolor, citecolor, urlcolor, toccolor
分别指定了内部链接的文本颜色, 引用 (引文) 链接的文本颜色, 外部链接的文本颜色,
toc 文本颜色. 可以使用任意预定义的 LaTeX 颜色.
说到底, beamer 是一个 LaTeX 包, 这里也记录可以传递的与 LaTeX 相关的变量.
papersize
纸张大小. 如 letter, A4 等.
fontsize
正文文本的字体大小, 如 10pt, 12pt 等.
documentclass
文档类别, 如 article, report, book, memoir.
classoption
文档类别的选项, 如 oneside, 可以指定多个选项.
geometry
option for geometry package, e.g. margin=1in; may be repeated for multiple
options
margin-left, margin-right, margin-top, margin-bottom
sets margins, if geometry is not used (otherwise geometry overrides these)
linestretch
adjusts line spacing using the setspace package, e.g. 1.25, 1.5
fontfamily
font package for use with pdflatex: TeX Live includes many options, documented
in the LaTeX Font Catalogue. The default is Latin Modern.
fontfamilyoptions
options for package used as fontfamily: e.g. osf,sc with fontfamily set to
mathpazo provides Palatino with old-style figures and true small caps; may be
repeated for multiple options
mainfont, sansfont, monofont, mathfont, CJKmainfont
font families for use with xelatex or lualatex: take the name of any system
font, using the fontspec package. Note that if CJKmainfont is used, the xecjk
package must be available.
mainfontoptions, sansfontoptions, monofontoptions, mathfontoptions, CJKoptions
options to use with mainfont, sansfont, monofont, mathfont, CJKmainfont in
xelatex and lualatex. Allow for any choices available through fontspec, such as
the OpenType features Numbers=OldStyle,Numbers=Proportional. May be repeated
for multiple options.
fontenc
allows font encoding to be specified through fontenc package (with pdflatex);
default is T1 (see guide to LaTeX font encodings)
microtypeoptions
options to pass to the microtype package
colorlinks
add color to link text; automatically enabled if any of linkcolor, citecolor,
urlcolor, or toccolor are set
linkcolor, citecolor, urlcolor, toccolor
color for internal links, citation links, external links, and links in table of
contents: uses any of the predefined LaTeX colors
links-as-notes
causes links to be printed as footnotes
indent
uses document class settings for indentation (the default LaTeX template
otherwise removes indentation and adds space between paragraphs)
subparagraph
disables default behavior of LaTeX template that redefines (sub)paragraphs as
sections, changing the appearance of nested headings in some classes
thanks
specifies contents of acknowledgments footnote after document title.
toc
include table of contents (can also be set using –toc/–table-of-contents)
toc-depth
level of section to include in table of contents
secnumdepth
numbering depth for sections, if sections are numbered
lof, lot
include list of figures, list of tables
bibliography
bibliography to use for resolving references
biblio-style
bibliography style, when used with –natbib and –biblatex.
biblio-title
bibliography title, when used with –natbib and –biblatex.
biblatexoptions
list of options for biblatex.
缺省的, slide level 是指文档中最高级别的标题 (后面直接跟内容的标题,
而不是其它后面又跟着标题的标题). 比如下面例子中, 二级标题才是 slide level:
% Habits
% John Doe
% March 22, 2005
# In the morning
## Getting up
- Turn off alarm
- Get out of bed
## Breakfast
- Eat eggs
- Drink coffee
# In the evening
## Dinner
- Eat spaghetti
- Drink wine
------------------
![picture of spaghetti](images/spaghetti.jpg)
## Going to sleep
- Get in bed
- Count sheep
当然, slide level 可以通过选项 --slide-level
进行指定.
分割幻灯片的规则:
高于 slide level 的内容不会在幻灯片中显示
比如, slide level 是 2, 则一级标题后的内容不会在幻灯片中显示.
pandoc title block 总是单独占一页
插入暂停:
指有用户按键后才会出现下一条目, . . .
, 点中间有空格.
对于列表, 可以使用这样的引用块的方式实现.
> + item1
> + item2
header 属性:
beamer 只支持 allowframebreaks 类别用于设置 allowframebreaks 选项,
其结果是若一页幻灯片内容太多会盖到 frame, 那么会导致分页.
# References {.allowframebreaks}
beamer 的 frame 属性:
Sometimes it is necessary to add the LaTeX [fragile] option to a frame in beamer (for example, when using the minted environment). This can be forced by adding the fragile class to the header introducing the slide:
# Fragile slide {.fragile}
All of the other frame attributes described in Section 8.1 of the
Beamer User’s Guide may also be used: allowdisplaybreaks,
allowframebreaks, b, c, t, environment, label, plain, shrink.