I'm trying to automate \(\LaTeX\) compilation from Emacs as much as I can. Here are the shell scripts and Emacs functions that I'm using.
Shell Scripts
Here are some very simple scripts for compiling \(\LaTeX\) files with arara and the fish shell. The first, called "mkt" for "make TeX", runs arara on the source file, then opens the resulting PDF.
|
|
The second, called "mktc" for "make TeX continuously", runs arara, opens the PDF, watches for changes, and runs arara whenever the file is saved.
|
|
Emacs
Here are some functions to use in Emacs to run the scripts.
Auctex
|
|
The first compiles with an asynchronous shell command, so that you can immediately return to editing the file while arara runs. I decided to use start-process-shell-command
instead of async-shell-command
for mktc
, since mkt
runs once and stops, while mktc
keeps running in the background. When rlr/tex-mktc
is called, a process is started that has the same name as the file with "mktc-" prepended it to it. The process is shown in a buffer that has the same name. That way, several files can be compiled at the same time.
Org Mode
|
|
These functions first export the org file to \(\LaTeX\), then compile the corresponding TeX files. All in all, a morning's worth of work to save a few keystrokes. I run them using major mode hydras.