I'm learning how to \usepackage{nomencl}
. So far so good.
I added the nomenclature compile option to the Emacs commands by editing my .emacs file, adding:
;; nomenclature for latex
(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("Nomenclature" "makeindex %s.nlo -s nomencl.ist -o %s.nls" TeX-run-command nil t :help "Create nomenclature file")))
to it, this works: when I press C-c C-c
(the shortcut for TeX-command-list
I can use the Nomenclature
command and the appropriate file is generated. I am unhappy though, for the following reason:
When I run BibTeX, and then press C-c C-c
again, Emacs offers to run LaTeX (as appropriate, and if references have changed, it will offer Command: (default) LaTeX
again, finally, it will offer Command (default) View
, once the .log doesn't report references have changed. When I run Nomeclature, the next command offered by Emacs is Command (default) View
, which is always inappropriate.
How can I tell Emacs to default to LaTeX as the next
TeX-command-list
command after running Nomenclature (same behavior as BibTeX)?
Best Answer
The easiest way (that I know of) is to use a function in the place of
TeX-run-command
like:You should use
TeX-command-default
instead of"LaTeX"
since that will automatically choose between latex or plain tex etc. Note that I usedTeX-run-compile
instead ofTeX-run-command
since for some reason I couldn't get that to work.You can also create a custom "sentinel" function which will check for errors etc. See
TeX-BibTeX-sentinel
as an example. This would allow you to conditionally change what the next command is based on whether there are errors etc. I don't think you have to, or even want to, do that in this case, but you can if you need to in the future.