When I paste a text inside quotation marks into Emacs+AUCTeX, AUCTeX formats it with a soft red color (see the screenshot below at the first line).

I like this color. However, I'm using csquotes package to handle (multilingual) quotations marks. The \enquote commands (provided by csquote package) use another color. I don't like this last color (see screenshot at the second line). With this ugly soft green color, I cannot find quickly quotation inside a big document.

How can I change csquotes default color to use AUCTeX default one?

The screenshot:

enter image description here

(This screenshot uses French quotation marks but it hasn't any influence on my question.)

There is a bunch of settings about fontification in the csquotes.el file but I didn't see any reference to colors:

  ;; Fontification
   (when (and (featurep 'font-latex)
          (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("DisableQuotes" "")
                ("RestoreQuotes" ""))
     (font-latex-add-keywords '(("enquote" "*{")
                ("foreignquote" "*{{")
                ("hyphenquote" "*{{")
                ("textcquote" "*[[{[{")
                ("foreigntextcquote" "*{[[{[{")
                ("hyphentextcquote" "*{[[{[{")
                ("textquote" "*[[{")
                ("foreigntextquote" "*{[[{")
                ("hyphentextquote" "*{[[{")
                ("blockquote" "[[{")
                ("foreignblockquote" "{[[{")
                ("hyphenblockquote" "{[[{")
                ("blockcquote" "[[{[{")
                ("foreignblockcquote" "{[[{[{")
                ("hyphenblockcquote" "{[[{[{"))
     (font-latex-add-keywords '(("setquotestyle" "[{")
                ("MakeOuterQuote" "{")
                ("MakeInnerQuote" "{")
                ("MakeAutoQuote" "*{{")
                ("MakeForeignQuote" "*{{{")
                ("MakeHyphenQuote" "*{{{")
                ("MakeBlockQuote" "{{{")
                ("MakeForeignBlockQuote" "{{{{")
                ("MakeHyphenBlockQuote" "{{{{")
                ("DeclareQuoteStyle" "[{[[{[{[{[{")
                ("DeclareQuoteAlias" "[{{")
                ("DeclareQuoteOption" "{")
                ("DeclarePlainStyle" "{{{{")
                ("SetBlockThreshold" "{")
                ("SetBlockEnvironment" "{")
                ("SetCiteCommand" "{"))

;;; csquotes.el ends here

This is a general approach, so you can use it to customize any other faces:

  1. Place your cursor under the word whose color you want to change and M-xdescribe-char.
  2. You will be prompted with some information. Check There are text properties here: section, and copy the face link text. (something like font-lock-keyword-face for example)
  3. M-xcustomize-face RET and paste the previously copied text (for instance font-lock-keyword-face in this case) RET.
  4. Modify the color and click/enter Apply and Save.
| improve this answer | |
  • Thank you for describe-char. When wanting to inspect text properties in the past I've always written a snippet in scratch-buffer! No more! – PuercoPop Mar 20 '15 at 22:54

Take a look at font-latex-user-keyword-classes, e.g.

(setq font-latex-user-keyword-classes
      '(("quotes" '("enquote" "*{") font-latex-string-face command))))

, as described in the info manual (info "(auctex) Fontification of macros"). Note that changing this variable may require a restart of Emacs. Also, I don't know what happens in case of multiple definitions, i.e. by this variable and by your package.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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