Emacsist RSS --- If never, make it ever: C-h C-h

Speed up pdf export from org-mode with latexmk


这里 查看更多 Emacs 相关推荐文章最新 Emacs 圈的动态. 欢迎关注微信公众账号: Emacsist

These days I write almost everything (e.g. research papers, lecture notes and slides) in org-mode, and then export to pdf (see my posts on org-mode here). This is a really pleasant and efficient way to create documents, but when working on a long document, it can take several seconds for emacs to compile the exported latex to pdf. During that time, emacs is hung up waiting for the compilation to finish, which is annoying.

I thought I’d share my workflow for streamlining this process. The key ingredient is not part of emacs. I use latexmk which is a perl script that watches a latex file and compiles it if it changes (or any file that it depends on changes). It will repeat the compilation (including calling bibtex) as many times as needed to resolve all references.

So, if I am working on a file, say document.org, I will run latexmk on the corresponding tex file using

latexmk -pvc -pdf -view=none document.tex

Here, the -pcv option means to keep watching the file for changes and recompile as needed; the -pdfoption means build a pdf from the latex using pdflatex, and -view=none tells latexmk not to open a pdf viewer to show the resulting pdf.

I then open the resulting document.pdf in skim, an excellent pdf viewer for the Mac (unfortunately hosted on sourceforge). The killer feature of skim compared to the built-in OS X preview app, is that it will automatically redisplay a pdf if the file changes (I believe evince or okular on linux do the same).

Putting the pieces together, I have latexmk running in a terminal, and an emacs window and skim window side by side. I then export my org file to latex with e.g. C-c C-e l l which happens almost instantly and gives me control back of emacs. The latex is compiled in the background by latexmkand then a few seconds later the pdf updates in skim and I can see my changes.

原文出处: Pragmatic Emacs
原文地址: http://pragmaticemacs.com/emacs/speed-up-pdf-export-from-org-mode-with-latexmk/
原文时间: 2016-01-27 05:06
本文地址: http://emacsist.com/10707
整理时间: 2016-01-27 22:00

本文由 Hick 整理,转载请保留以上信息;
COPYLEFTThe articles on this site come from Internet, thanks to all the original authors.
      If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .