【发布时间】:2014-08-14 19:00:49
【问题描述】:
我正在尝试通过 knitr 自动处理 org-mode 文件,最后是 pdf。为此,我使用来自 https://github.com/chasberry/orgmode-accessories 的 ox-ravel.el。基本上我想要 org-mode 导出中的另一个条目,它允许我 C-c C-e l q 运行 org-ravel-latex-noweb-pdf-dispatch:
(org-export-define-derived-backend 'latex-noweb 'latex
:translate-alist '((src-block . org-ravel-src-block)
(inline-src-block . org-ravel-inline-src-block))
:menu-entry
'(?l 1
((?q "As KnitR PDF" org-ravel-latex-noweb-pdf-dispatch))))
这似乎删除了 ox-ravel 中类似派生后端的当前条目:
(org-export-define-derived-backend 'latex-noweb 'latex
:translate-alist '((src-block . org-ravel-src-block)
(inline-src-block . org-ravel-inline-src-block))
:menu-entry
'(?l 1
((?r "As Rnw File" org-ravel-latex-noweb-dispatch))))
感谢任何使这两个条目出现的提示。现在是更棘手的部分。我希望 org-ravel-latex-noweb-pdf-dispatch 首先导出到 Rnw 文件,方法如下:
(defun org-ravel-latex-noweb-dispatch
(&optional async subtreep visible-only body-only ext-plist)
"Execute menu selection. See org-export.el for meaning of ASYNC,
SUBTREEP, VISIBLE-ONLY and BODY-ONLY."
(interactive)
(if async
(message "No async allowed.")
(let
((outfile (org-export-output-file-name ".Rnw" subtreep)))
(org-export-to-file 'latex-noweb
outfile async subtreep visible-only
body-only ext-plist))))
.Rnw 文件导出后,我需要运行 ess-swv-weave 来导出 .tex 文件。然后我想运行 org-latex-compile 以获得最终的 pdf。以下是可能相关的 org-latex-export-to-pdf 的一部分:
(defun org-latex-export-to-pdf
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to LaTeX then process through to PDF."
(interactive)
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-to-file 'latex outfile
async subtreep visible-only body-only ext-plist
(lambda (file) (org-latex-compile file)))))
任何帮助结合上述想法以使 C-c C-e l q 生成所需的 pdf 将不胜感激!
【问题讨论】:
标签: emacs elisp org-mode knitr ess