AUCTeX actually makes this very easy: customize LaTeX-font-list
.
(add-to-list 'LaTeX-font-list
'(?\C-p "\\pname{" "}"))
should work. You'll have to re-run LaTeX-mode
in the appropriate buffers if you have any open.
Note that this must be done after LaTeX-font-list
has been defined in latex.el
. Here is a simple configuration with use-package
:
(use-package latex
:ensure auctex
:config
(add-to-list 'LaTeX-font-list
'(?\C-p "\\pname{" "}")))
As @DavidCarlisle has indicated, if a .nlo
gets recreated with each run,
this causes an update of the .nls
target, then of the .pdf
target.
But then .nlo
has been updated again, so the cycle repeats every time
you invoke make
.
To overcome that, you'd use a checksum file instead of the .nlo
dependency,
and touch the checksum file only if the .nlo
file contents have changed.
Here is an untested Makefile fragment:
$(DOCNAME).nls: $(DOCNAME).nlo-stamp
makeindex -s nomencl.ist -o $@ $(DOCNAME).nlo
$(DOCNAME).nlo-stamp: $(DOCNAME).nlo
sha1sum $^ >$@2
if cmp -s $@2 $@; then rm $@2; else mv -f $@2 $@; fi
Replace your rule for $(DOCNAME).nls
with that.
Do not forget to append *.*-stamp
*.*-stamp2
to the list of files to clean.
Note: If you copy-paste Makefile fragments, pipe them through unexpand
to regenerate the TAB characters.
Instead of the above, I'd suggest using
latexmk
.
It does such things properly
and figures out all necessary program runs automatically.
With latexmk
, a complete GNU Makefile generally looks like the following
(just tune DOCNAME
):
# Tools
LATEXMK = latexmk
RM = rm -f
# Project-specific settings
DOCNAME = basename-of-your-main-document
# Targets
all: doc
doc: pdf
pdf: $(DOCNAME).pdf
# Rules
%.pdf: %.tex
$(LATEXMK) -pdf -M -MP -MF $*.d $*
mostlyclean:
$(LATEXMK) -silent -c
$(RM) *.bbl
clean: mostlyclean
$(LATEXMK) -silent -C
$(RM) *.run.xml *.synctex.gz
$(RM) *.d
.PHONY: all clean doc mostlyclean pdf
# Include auto-generated dependencies
-include *.d
This keeps track of dependencies automatically.
Even if only an installed and used package file has changed,
make
triggers recompilation.
This is almost perfect. Almost because if you shadow a texmf-dist
package
with a local one, the changed dependency path is not detected automatically.
It will however be recorded with the next TeX run.
To get the custom index files processed, add a latexmkrc
file:
add_cus_dep('nlo', 'nls', 0, 'makenlo2nls');
sub makenlo2nls {
system( "makeindex -o \"$_[0].nls\" -s nomencl.ist \"$_[0].nlo\"" );
}
BibTeX processing should work without extra configuration.
Best Answer
Add the following code to your init file:
Then you'll be able to call the
make
program with C-c C-cMake
RET.Replace the second element of the list with
"make -C build/digital"
if you want"make -C build/digital"
by default, and the fourth element tot
instead ofnil
if you want to have the chance to modify themake
command instead of sticking with the default (which you can change interactively with C-u C-c C-c anyway).