help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Howto disable syntax-highlighting for '$'-enclosed math?


From: Stefan Klinger
Subject: Howto disable syntax-highlighting for '$'-enclosed math?
Date: Fri, 19 Mar 2010 17:05:45 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hello,

I need to disable the syntax-highlighting for '$'-enclosed math in LaTeX
mode. This is quite important for me: I'm typesetting a lot of XQuery code
snippets that contain '$' characters to mark variable names:

  \iquery{$q = "foo"}
  
or, as an environment:

  \begin{query}
fn:count($doc//target)
  \end{query}
  
These code snippets are typeset with the "listings" package.

Emacs always displays text following a '$' in green until another '$'
occurs. This is annoying, and basically wrong because I never entered math
mode. As a workaround I started adding "%$<newline>" sequences to end the
highlighting, but this interferes heavily with M-q (bound to
fill-paragraph). Also, it's an ugly hack.

So how can I make the LaTeX-mode handle $ as an ordinary character?

Btw.: Using \$ in the queries is not a good option: I failed to configure the
listings package to accept this. Also, an advantage of the listings package is
that the queries do not need escaping.

Thak you very much!
Stefan



-- 
Stefan Klinger                                      o/klettern
                                                    /\/  bis zum
send plaintext only - max size 32kB - no spam         \   Abfallen
http://stefan-klinger.de




reply via email to

[Prev in Thread] Current Thread [Next in Thread]