3

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" ""))
                  'function)
     (font-latex-add-keywords '(("enquote" "*{")
                ("foreignquote" "*{{")
                ("hyphenquote" "*{{")
                ("textcquote" "*[[{[{")
                ("foreigntextcquote" "*{[[{[{")
                ("hyphentextcquote" "*{[[{[{")
                ("textquote" "*[[{")
                ("foreigntextquote" "*{[[{")
                ("hyphentextquote" "*{[[{")
                ("blockquote" "[[{")
                ("foreignblockquote" "{[[{")
                ("hyphenblockquote" "{[[{")
                ("blockcquote" "[[{[{")
                ("foreignblockcquote" "{[[{[{")
                ("hyphenblockcquote" "{[[{[{"))
                  'textual)
     (font-latex-add-keywords '(("setquotestyle" "[{")
                ("MakeOuterQuote" "{")
                ("MakeInnerQuote" "{")
                ("MakeAutoQuote" "*{{")
                ("MakeForeignQuote" "*{{{")
                ("MakeHyphenQuote" "*{{{")
                ("MakeBlockQuote" "{{{")
                ("MakeForeignBlockQuote" "{{{{")
                ("MakeHyphenBlockQuote" "{{{{")
                ("DeclareQuoteStyle" "[{[[{[{[{[{")
                ("DeclareQuoteAlias" "[{{")
                ("DeclareQuoteOption" "{")
                ("DeclarePlainStyle" "{{{{")
                ("SetBlockThreshold" "{")
                ("SetBlockEnvironment" "{")
                ("SetCiteCommand" "{"))
                  'variable)))))

;;; csquotes.el ends here
  • How about considering adding \enquote to the font command, like \emph etc. Then you can also give it a nice shortcut. That is the LaTeX-font-list variable. That being said, I do not know how to change the font on it. It ought to be there somewhere since Emacs know to format \textbf and \emph differently. – daleif May 19 '14 at 10:12
  • @daleif I don't need a shortcut (I can call \enquote by pressing " twice). I can add enquote to LaTeX-font-list but I don't know (either) how to set a color to this command... – ppr May 19 '14 at 10:18
  • How did you get the double " shortcut? I like the font listfeature as it makes it easy to change the macro or remove it. There is some info about the fonts used in latex-font.el in the auctex sources. – daleif May 19 '14 at 11:05
  • @daleif It is a feature of AUCTeX/csquotes. See the doc The setting is: LaTeX-csquotes-quote-after-quote – ppr May 19 '14 at 14:00
  • The hint is in the section of code you provided in the question -- enquote is assigned a property value of 'textual. If you search the source-code for latex-font.el as @daleif indicated, you will find the section of code that uses font-lock-type-face. Did you try placing your cursor on the color you want to change and type?: C-u C-x = If you did that, did the information window say font-lock-type-face was a face at that particular point? And if it said that, did you try changing the color for font-lock-type-face using M-x customize-face RET font-lock-type-face RET – lawlist Mar 8 '15 at 6:05

Your Answer

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

Browse other questions tagged or ask your own question.