2

How do I need to set up Emacs/AucTeX, so that when I type C-c, C-a, the following sequence of commands will be run? (Note: the LaTeX file name is test.tex.)

lualatex test  
makeglossaries test
makeindex test
biber test
lualatex test
lualatex test

Ideally, if one of the generated auxiliary files is already up-to-date, the corresponding line will be automatically skipped.

Evan Aad
  • 1,461
  • 1
  • 14
  • 29
  • 1
    If `TeX-command-run-all` is still sufficiently close to (my) original implementation the next command to run is determined through `TeX-command-default` (which see). If you need you can just advice `TeX-command-default`. – Tobias Mar 12 '19 at 14:37
  • @Tobias: I have rewritten my question from scratch. Could you please take another look at it? If you write a detailed answer I will be very grateful. – Evan Aad Mar 18 '19 at 08:20
  • 1
    A per document specification of determined build steps looks very much a job for [arara](https://emacs.stackexchange.com/a/9718/18951). – gusbrs Mar 18 '19 at 17:30
  • 1
    @EvanAad Could it be that the only difference to the current execution order is the makeglossaries entry? Note also the following comment from TeX-command-default: "makeindex should be run when final document is almost complete" with reference to http://tex.blogoverflow.com/2012/09/dont-forget-to-run-makeindex – Tobias Mar 19 '19 at 00:12
  • @Tobias: I don't mind the order. Wait. So you're telling me that by simply entering `C-c C-a` AucTex will know to process a document containing a glossary, an index and a bibliography, without my having to set it up in any special way? – Evan Aad Mar 19 '19 at 05:05
  • `biber` and `makeindex` are handled in `TeX-command-default`. For `biber` the option `LaTeX-using-Biber` must be set to non-nil (e.g., t). It looks like `makeglossery` is not yet treated in `TeX-command-default`. It is clear that you must also have set Command->TeXing Options to Use LuaTeX engine. Now my question: If you call `TeX-command-run-all` on a new TeX file with all your wanted features is then the glossary the only thing that has not been processed? – Tobias Mar 19 '19 at 08:44
  • You can observe the sequence of commands executed by C-c C-a when you repeatedly input C-c C-c instead. If the current implementation follows my old one the sequence of commands is (almost) the same. The only difference are some protections such as one command is not executed too often in sequence to avoid cycling. – Tobias Mar 19 '19 at 09:17

1 Answers1

1

Step 1

At the top of the .tex file insert the following.

% arara: lualatex
% arara: biber
% arara: makeglossaries
% arara: makeindex
% arara: lualatex
% arara: lualatex

Step 2

In your ~/.emacs file insert the following.

(with-eval-after-load "tex"
  (add-to-list 'TeX-command-list
        `("Arara" "arara --verbose %s" TeX-run-TeX nil t :help "Run Arara") t))

(with-eval-after-load "latex"
  (define-key LaTeX-mode-map (kbd "C-c C-a")
     (lambda ()
       (interactive)
       (TeX-command-sequence '("Arara" "View") t))))
Evan Aad
  • 1,461
  • 1
  • 14
  • 29