![从 Org-mode 导出到 Beamer 时出错](https://linux22.com/image/323899/%E4%BB%8E%20Org-mode%20%E5%AF%BC%E5%87%BA%E5%88%B0%20Beamer%20%E6%97%B6%E5%87%BA%E9%94%99.png)
当我尝试从 org 导出到 beamer 时,我收到以下消息:
处理 LaTeX 文件 ./ppt.tex... org-latex-compile:未生成 PDF 文件 ./ppt.pdf:[未定义的控制序列]
我不知道这是什么意思。有人能帮我理解并修复这个错误吗?也许我没有正确配置emacs适合这种出口吗?
这是我从 TeX.SX 中的一个问题中复制的文件的一部分.emacs
。我不确定我是否配置了 AUCTeX,shell-escape
但我希望.emacs
在最终的 pdf(无论是文章还是 beamer 演示文稿)中包含一些 python 行时,文件中有正确的代码。
;; Org mode and bearmer export
(require 'ox-beamer)
(setq org-latex-to-pdf-process
'("pdflatex --shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex --shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex --shell-escape -interaction nonstopmode -output-directory %o %f"))
(defun my-beamer-bold (contents backend info)
(when (eq backend 'beamer)
(replace-regexp-in-string "\\`\\\\[A-Za-z0-9]+" "\\\\textbf" contents)))
(add-to-list 'org-export-filter-bold-functions 'my-beamer-bold)
(setq org-src-fontify-natively t)
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)
(latex . t)))
(setq org-confirm-babel-evaluate nil)
(setq org-babel-python-command "ipython --pylab --pdb --nosep --classic --no-banner --no-confirm-exit")
(setq org-latex-listings 'minted)
(setq org-latex-minted-options
'(("fontsize" "\\footnotesize")("bgcolor" "black")("obeytabs" "true")))
(require 'ox-latex)
(setq org-src-fontify-natively t)
(setq org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(setq org-src-preserve-indentation t)
以下是ppt.org
我无法翻译成pdf的文件!
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation, smaller]
#+BEAMER_THEME: CambridgeUS
#+BEAMER_FRAME_LEVEL: 2
#+OPTIONS: H:3 email:n |:t
#+TITLE: CNT antennas
#+AUTHOR: W.W.
#+DATE: Dec 2015
* What are CNTs?
** who, what, when, how
* How do antennas work?
** /what/, when, how
- a short description of a simple antenn
- what parameters define the quality of an antenna
- what are the common use of an antenna
* How can CNTs be used as antennas?
- how does it work?
+ describe the advantages...
+ ...and the disadvantages
- any alternative materials?
* Other applications of CNTs to communications
- self-assembly
see ch.4 of S.F. Bush "Nanoscale Communication Networks"
答案1
我已将您提供的代码添加到我的 emacs 设置中(可以在我的 github 上找到,抱歉进行了宣传),并使用 emacs 24.4.1 。
错误来自句子/what/, when, how
。Beamer 不太喜欢使用\emph{}
章节标题中使用的和其他命令。避免这种情况的一种方法是使用 LaTeX 命令:** \protect\emph{what}, when, how
。
结果是:
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation, smaller]
#+BEAMER_THEME: CambridgeUS
#+BEAMER_FRAME_LEVEL: 2
#+OPTIONS: H:3 email:n |:t
#+TITLE: CNT antennas
#+AUTHOR: W.W.
#+DATE: Dec 2015
* What are CNTs?
** who, what, when, how
* How do antennas work?
** \protect\emph{what}, when, how
- a short description of a simple antenn
- what parameters define the quality of an antenna
- what are the common use of an antenna
* How can CNTs be used as antennas?
- how does it work?
+ describe the advantages...
+ ...and the disadvantages
- any alternative materials?
* Other applications of CNTs to communications
- self-assembly
see ch.4 of S.F. Bush "Nanoscale Communication Networks"
目前我还没有找到仅使用 org 命令的解决方案,如果有人有的话,我很感兴趣。