Many non-base commands, quite used today, are not recognized as such by AUCTeX. This is understandable as not everyone will use them, and not every time. I'm thinking about commands like \enquote{...}
. Is there a way of making recognizing them—that is, of introducing new commands into the AUCTeX database? I've tried following these instructions to introduce new commands, but they don't work for me.
1 Answer
If you are happy with fontification (as explained in http://lists.gnu.org/archive/html/emacs-orgmode/2009-05/msg00236.html) you can add the following to your .emacs. It adds fontification for some macros, such as some from biblatex
, csquotes
, cleveref
and enumitem
. If you want to add or remove macros from the configuration it is easily done, just check the manual.
;; Fontification
;; http://lists.gnu.org/archive/html/emacs-orgmode/2009-05/msg00236.html
;; http://www.gnu.org/software/auctex/manual/auctex/Fontification-of-macros.html
(setq font-latex-match-reference-keywords
'(
;; biblatex
("printbibliography" "[{")
("addbibresource" "[{")
;; Standard commands
;; ("cite" "[{")
("Cite" "[{")
("parencite" "[{")
("Parencite" "[{")
("footcite" "[{")
("footcitetext" "[{")
;; Style-specific commands
("textcite" "[{")
("Textcite" "[{")
("smartcite" "[{")
("Smartcite" "[{")
("cite*" "[{")
("parencite*" "[{")
("supercite" "[{")
;; Qualified citation lists
("cites" "[{")
("Cites" "[{")
("parencites" "[{")
("Parencites" "[{")
("footcites" "[{")
("footcitetexts" "[{")
("smartcites" "[{")
("Smartcites" "[{")
("textcites" "[{")
("Textcites" "[{")
("supercites" "[{")
;; Style-independent commands
("autocite" "[{")
("Autocite" "[{")
("autocite*" "[{")
("Autocite*" "[{")
("autocites" "[{")
("Autocites" "[{")
;; My custom cite commands
("posscite" "[{")
("Posscite" "[{")
("posscites" "[{")
("Posscites" "[{")
;; Text commands
("citeauthor" "[{")
("Citeauthor" "[{")
("citetitle" "[{")
("citetitle*" "[{")
("citeyear" "[{")
("citedate" "[{")
("citeurl" "[{")
;; Special commands
("fullcite" "[{")
;; cleveref
("cref" "{")
("Cref" "{")
("cpageref" "{")
("Cpageref" "{")
("cpagerefrange" "{")
("Cpagerefrange" "{")
("crefrange" "{")
("Crefrange" "{")
("labelcref" "{")))
(setq font-latex-match-textual-keywords
'(
;; biblatex brackets
("parentext" "{")
("brackettext" "{")
("hybridblockquote" "[{")
;; Auxiliary Commands
("textelp" "{")
("textelp*" "{")
("textins" "{")
("textins*" "{")
;; subcaption
("subcaption" "[{")))
(setq font-latex-match-variable-keywords
'(
;; amsmath
("numberwithin" "{")
;; enumitem
("setlist" "[{")
("setlist*" "[{")
("newlist" "{")
("renewlist" "{")
("setlistdepth" "{")
("restartlist" "{")
("crefname" "{")))
C-c RET
andC-c C-e
? If you only want fontification (e.g. syntax highlighting) for new commands see the heading;; Fontification
in the .emacs example in tex.stackexchange.com/a/50919/5701