Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Do you mean to add commands such that they are known by and suggested by C-c RET and C-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 –  N.N. Dec 8 '12 at 9:40
    
Thanks, N.N. If you would like to add a piece of the code as an answer, I'll acknowledge it as such. –  NVaughan Dec 8 '12 at 15:24
add comment

1 Answer 1

up vote 10 down vote accepted

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" "{")))
share|improve this answer
    
Cheers!......... –  NVaughan Dec 8 '12 at 20:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.