【问题标题】:elisp: generate LaTeX PDF documentelisp:生成 LaTeX PDF 文档
【发布时间】:2012-08-03 12:00:51
【问题描述】:

我试图完全自动化发送工作申请。第一步,把公司的名字写在信里。它几乎可以工作,但它被卡住了,因为它询问要使用什么命令。阅读文档,我认为它可以被前缀参数禁用,但我出错了。此外,它不需要通过视觉闪烁,它可以完全作为后台进程完成。我把代码贴上来,你马上就明白了:

(哦,我在 emacs 中使用 LaTeX/P 模式 - 目标不仅是更新 .tex 文件,还要更新 .pdf 文件)

(defun edit-letter (comp-name)
  (let ((path "~/work/letter/comp"))
    (edit-letter-file-path comp-name (concat path "/eng/letter.tex")) 
    (edit-letter-file-path comp-name (concat path "/swe/brev.tex")) ))

(defun edit-letter-file-path (company-name file-path)
  (find-file file-path)
  (goto-line 14)
  (kill-line)
  (insert (format "\\textbf{To %s}\n" company-name))
  (setq current-prefix-arg nil)
  (call-interactively 'TeX-command-master) ; asks what command
  (kill-buffer) ) ; doesn't work

(edit-letter "Digital Power Now")

【问题讨论】:

  • 好的,这样解决了。不多,但它的工作原理。结束上面的第二个函数:(shell-command (concat "pdflatex --output-directory ~/work/letter/comp " file-path))

标签: pdf emacs latex elisp


【解决方案1】:

你的问题并不完全清楚你在追求什么,但如果你想使用 AucTeX 调用 LaTeX/PDFTex/BibTex 进程而不提示输入命令名称,你可以使用这个:

(TeX-command "LaTeX" 'TeX-master-file)

试试这个代替上面的(call-interactively 'TeX-command-master)。当您使用 LaTeX/P 时,“LaTeX”实际上意味着 pdflatex。

【讨论】:

  • 这是很久以前的事了,所以我忘记了细节。但我设法解决了它(见我上面的评论)。无论如何,感谢您的努力和提示:)
  • 我不知道你的问题有多老,我只是在浏览未回答的问题并看到它。我今天只是在为一个项目使用这段代码,所以我很新鲜!
  • 不,一般来说,当然回答任何问题都是 100% 正确的,无论时间长短。如果您喜欢 Emacs 和 (E)Lisp,可以查看最终结果 here
猜你喜欢
  • 2011-03-14
  • 2023-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-26
  • 2011-02-14
  • 2020-08-09
  • 2012-03-06
相关资源
最近更新 更多