缘由:

  • 之前做幻灯一直用 powerpoint,受限于各种格式调整,之后接触到了 latex,开始用 beamer 做幻灯
  • 最近迷恋上了 Reproducible Research,用 org-mode 进行时间管理、写 blog,恰巧最近需要做幻灯,本文记录用 org-mode 进行写做幻灯的过程以及注意事项,本文示例见org-beamer

配置

  • Org-mode 做幻灯实际上是用 org-mode 写做,转换成 latex 的 beamer,鉴于以后可能会用到中文,因此用 xelatex 编译 tex 文件
  • 导出快捷键:SPC e l P,更改 tex 默认编译引擎,我安装的是 Tex live 版本,安装详情见1,更改引擎可参照0

Org-mode 做幻灯过程简介

Org-mode Beamer 模式设置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#+TITLE:  Multiple therapeutic effects of progranulin on experimental acute ischaemic stroke
#+AUTHOR: Xiaowei Mao
#+EMAIL:  maoweirm@126.com
#+BEAMER_HEADER: \date[March 4$^{th}$, 2016]{March 4$^{th}$, 2016 \\ \vskip 0.5cm \scriptsize{Brain. 2015 Jul;138(Pt 7):1932-48.}}
#+BEAMER_HEADER: \title[Progranulin on ischemic stroke]{Multiple therapeutic effects of progranulin on experimental acute ischaemic stroke}
#+BEAMER_HEADER: \institute[Pharmaron]{Pharmacology, Pharmaron}
#+OPTIONS: H:2 num:t toc:1 \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
#+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra)
#+BEAMER_FRAME_LEVEL: 2
#+LaTeX_HEADER: \usetheme{CambridgeUS}
#+LaTeX_HEADER: \AtBeginSection{\begin{frame}{Outline}   \tableofcontents[currentsection] \end{frame} }
#+LaTeX_HEADER: \setbeamertemplate{navigation symbols}{}
#+LaTeX_HEADER: \renewcommand\maketitle{\frame[plain]{\titlepage}}
#+LaTeX_HEADER: \usepackage{fontspec}
#+LaTeX_HEADER: \usepackage{xeCJK}
#+LaTeX_HEADER: \setmainfont{Times New Roman}
#+LaTeX_HEADER: \setsansfont{Arial}
#+LaTeX_HEADER: \setmonofont{Courier Std}
#+LaTeX_HEADER: \setCJKmainfont[BoldFont={ },ItalicFont={ }]{WenQuanYi Micro Hei}
#+LaTeX_HEADER: \setCJKsansfont{WenQuanYi Micro Hei}
#+LaTeX_HEADER: \setCJKmonofont{WenQuanYi Micro Hei Mono}
#+LaTeX_HEADER: \graphicspath{pic file folder}
#+BEAMER_HEADER: %\logo{\includegraphics[height=5mm]{logo.png}}
#+LaTeX_HEADER: \usepackage[backend = biber, natbib=true, style = science, sorting = none]{biblatex}
#+LaTeX_HEADER: \addbibresource{Pharmaron.bib}
#+LaTeX_HEADER: \AtBeginBibliography{\footnotesize}
#+LaTeX_HEADER: \setbeamertemplate{bibliography item}[text]
#+LaTeX_HEADER: \usepackage[none]{hyphenat}
#+LaTeX_HEADER: \usepackage[abs]{overpic}
  • 在幻灯首页及页脚短标题、时间以及系所
1
2
3
#+BEAMER_HEADER: \date[March 4$^{th}$, 2016]{March 4$^{th}$, 2016 \\ \vskip 0.5cm \scriptsize{Brain. 2015 Jul;138(Pt 7):1932-48.}}
#+BEAMER_HEADER: \title[Progranulin on ischemic stroke]{Multiple therapeutic effects of progranulin on experimental acute ischaemic stroke}
#+BEAMER_HEADER: \institute[Pharmaron]{Pharmacology, Pharmaron}
  • 常规设置,注意 H:2 表示目录两层
1
2
3
4
5
6
7
8
#+OPTIONS: H:2 num:t toc:1 \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
  • Beamer 主题选择,在每个 section 之前加入这个 section 的目录,标题页去掉页眉和页脚
1
2
3
4
#+LaTeX_HEADER: \usetheme{CambridgeUS}
#+LaTeX_HEADER: \AtBeginSection{\begin{frame}{Outline}   \tableofcontents[currentsection] \end{frame} }
#+LaTeX_HEADER: \setbeamertemplate{navigation symbols}{}
#+LaTeX_HEADER: \renewcommand\maketitle{\frame[plain]{\titlepage}}
  • 设置字体,用 fontspec 和 xeCJK 包
1
2
3
4
5
6
7
8
#+LaTeX_HEADER: \usepackage{fontspec}
#+LaTeX_HEADER: \usepackage{xeCJK}
#+LaTeX_HEADER: \setmainfont{Times New Roman}
#+LaTeX_HEADER: \setsansfont{Arial}
#+LaTeX_HEADER: \setmonofont{Courier Std}
#+LaTeX_HEADER: \setCJKmainfont[BoldFont={ },ItalicFont={ }]{WenQuanYi Micro Hei}
#+LaTeX_HEADER: \setCJKsansfont{WenQuanYi Micro Hei}
#+LaTeX_HEADER: \setCJKmonofont{WenQuanYi Micro Hei Mono}
  • 默认插入图片位置:
1
#+LaTeX_HEADER: \graphicspath{pic file folder}
  • 参考文献
1
2
3
4
5
#+BEAMER_HEADER: %\logo{\includegraphics[height=5mm]{logo.png}}
#+LaTeX_HEADER: \usepackage[backend = biber, natbib=true, style = science, sorting = none]{biblatex}
#+LaTeX_HEADER: \addbibresource{Pharmaron.bib}
#+LaTeX_HEADER: \AtBeginBibliography{\footnotesize}
#+LaTeX_HEADER: \setbeamertemplate{bibliography item}[text]
  • 取消断词,overpic 包
1
2
#+LaTeX_HEADER: \usepackage[none]{hyphenat}
#+LaTeX_HEADER: \usepackage[abs]{overpic}

插入小标题及分页

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
*** A block                                                           :BMCOL:
:PROPERTIES:
:BEAMER_col: 0.6
:END:
- A stroke is a medical emergency in which the blood supply to any portion of the brain is interrupted or reduced.
\vspace{0.5cm}
- Alternative names: Cerebrovascular accident/ disease (CVA), Cerebral infarction, Cerebral hemorrhage.
*** picture                                                         :BMCOL:
:PROPERTIES:
:BEAMER_col: 0.4
:END:
\includegraphics[width=4.5cm]{b1} \newline
\centering \scriptsize{The Circle of Willis Anatomy}

插入多张图片

1
2
3
4
5
6
\begin{overpic}[height=6cm, width=12cm]{b2}
\put(20,0){\visible<2>{\includegraphics[height=6cm, width=5.5cm]{b6}}}
\put(200,0){\visible<2>{\includegraphics[height=6cm, width=4.5cm]{b3}}}
\put(0,0){\visible<4>{\includegraphics[height=6cm, width=6.5cm]{b4}}}
\put(172,0){\visible<4>{\includegraphics[height=6cm, width=6cm]{b5}}}
\end{overpic}

插入 block

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
***                                                                 :BMCOL:
:PROPERTIES:
:BEAMER_col: 0.6
:END:
\includegraphics[height=5cm,width=\textwidth]{b10}
*** \pause \small Stroke therapeutic strategy                 :B_block:BMCOL:
:PROPERTIES:
:BEAMER_col: 0.4
:BEAMER_env: block
:END:
\begin{itemize}
\item \footnotesize Broaden the therapeutic time window
\begin{itemize}
 \item \scriptsize The new thrombolytics
 \item \scriptsize Neuroprotection agents-\emph{\textbf{progranulin}}
\end{itemize}
\item \footnotesize Therapy is recovery stage
\begin{itemize}
 \item \scriptsize Neuroprotection agents
 \item \scriptsize Stem cell therapy
 \item \scriptsize Chinese traditional medicine
 \item \scriptsize Acupuncture
 \item \scriptsize ......
\end{itemize}
\end{itemize}

插入参考文献

1
2
3
4
** References
\tiny
\cite{moretti2015neuroprotection} \cite{george2015novel} \cite{butcher2010acute} \cite{hacke2008thrombolysis} \cite{kanazawa2011biochemical} \cite{kanazawa2011inhibition} \cite{nguyen2013progranulin} \cite{o20061}
\printbibliography[heading = none]

一些问题

参考文献

  • 默认编译快捷键不能编译参考文献,在配置文件中加入一下代码即可
1
2
(setq org-latex-pdf-process
      '("xelatex -interaction nonstopmode -output-directory %o %f" "biber %b" "xelatex -interaction nonstopmode -output-directory %o %f" "xelatex -interaction nonstopmode -output-directory %o %f"))
  • 改变参考文献字体大小,加入一下代码

脚注

  • 如果文章某一页有脚注,插入\footfullcite{脚注内容}即可
  • 如果脚注连续,即插入参考文献 4-6,或 2,3,并且同一页插入两个相同脚注,可参考代码见2, 也可在我的 github 下载footnoteref

用\usepackage{footnoteref}

  • 改变脚注字体大小,加入一下代码

    1
    
    \renewcommand{\footnotesize}{\tiny}