我正试图通过编织机自动化一些组织模式文件的处理,最后生成一个pdf。为此,我使用了来自https://github.com/chasberry/orgmode-accessories的ox-ravel.el。基本上,我想要在组织模式导出中的另一个条目,它允许我运行pdf-分派的C C-e l:
(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中类似的派生后端的当前条目:
(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-胶乳-noweb-pdf-第一次导出到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来导出.tex文件。然后,我想运行org-胶乳编译,以获得一个最终的pdf。下面是组织乳液导出到-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生产所需的pdf将不胜感激!
发布于 2014-08-16 13:48:22
org-export-define-derived-backend的第一个参数是新后端的名称。由于您有两个同名为'latex-noweb的定义,原来的定义会被覆盖。
因此,将后端重命名为,比方说,乳胶针织品,并创建一个函数org-ravel-latex-noweb-pdf-dispatch,复制org-ravel-latex-noweb-dispatch的定义并修改。关键是org-export-to-file,它可以在处理后再使用一个参数,您可以使用它来编织.Rnw文件并编译生成的tex文件:
(defun org-ravel-latex-noweb-pdf-dispatch
(&optional async subtreep visible-only body-only ext-plist)
"Process org file through knitr. See org-export.el for meaning of
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
(lambda (file)
<< run `ess-swv-weave' on file >>
(let ((texfile (concat
(file-name-sans-extension file)
".tex")))
(org-latex-compile texfile)))))))https://stackoverflow.com/questions/25315704
复制相似问题