1

How can I achieve a proper highlighting in auctex/emacs?

I use the german guillemets (chevrons), but the highlighting is just revers as I would use the real (french) guillemets.

He says: »Who are you?« I reply: »Just a guy who wants proper highlighting.«

The bold parts are highlighted. For the standard syntax table I have this snippet in my ~/.emacs:

(modify-syntax-entry ?« ")»" (standard-syntax-table)) 
(modify-syntax-entry ?» "(«" (standard-syntax-table))

My guess was that a hook could help:

(add-hook 'LaTeX-mode-hook
  (lambda ()
    (modify-syntax-entry ?« ")»")
    (modify-syntax-entry ?» ")«")
))

But it didn't. The usual answer to this problem is, put

\usepackage[german]{babel}

in your preamble, but of course it is there.

2

Add this to your .emacs

(add-hook 'TeX-language-de-hook
      (lambda ()
        (when (and (eq TeX-install-font-lock 'font-latex-setup)
               (featurep 'font-latex))
          (font-latex-add-quotes '("»" "«" german)))))

In this way, when you load babel package with german option the quotes will be correctly fontified.

If you don't want to hook this feature to german option of babel use this code instead:

(eval-after-load "font-latex"
  '(progn
     (font-latex-add-quotes '("»" "«" german))))
  • No, unfortunately this does not work. – permaneder Jun 30 '13 at 9:40
  • @permaneder which version of AUCTeX and Emacs are you using? Do you have the lines (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil) in your .emacs (see the AUCTeX manual)? – giordano Jun 30 '13 at 9:44
  • I have the version from git and the above lines in my .emacs, yes. – permaneder Jun 30 '13 at 9:49
  • 1
    @permaneder is this code \usepackage[german]{babel} He says: "Who are you?"' I reply: "Just a guy who wants proper highlighting."'. correctly fontified in an AUCTeX buffer? – giordano Jun 30 '13 at 10:37
  • 1
    What's the value of font-latex-quote-list variable in that buffer? – giordano Jun 30 '13 at 12:11
0

I reply to the last comment with an answer, because it solved the problem.

I do not have a variable font-latex-quote-list but a variable font-latex-quotes. This variable was set to auto. In the menu is a option for german which I chose. Now the german quotes »« are fontified properly.

  • If font-latex-quotes is defined font-latex-quote-list should be defined as well, they're defined in the same file (font-latex.el of AUCTeX source), if you have one you must have the other. – giordano Jun 30 '13 at 12:56

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.