How to disable underscore subscript in TeX mode in emacs

After some random recent upgrade, emacs started doing something annoying: when in TeX mode (eg when editing LaTeX docs, which I do a lot), it would treat every underscore in the document as a signal that the next symbol should be subscripted, and display it as such: the character would be offset vertically using font-lock magic. This is very annoying, because underscore only means subscript in maths mode; the rest of the time, it’s wrong and silly to visibly subscript the thing. In general, I don’t want emacs to do such semi-WYSIWYG-ness – syntax highlighting is about as much as I need, thank you.

Anyway, how to turn it off is non-obvious, and required several increasingly imaginative google search strings. In the end I came across this recent thread on gnu.emacs.help, one of whose posts suggested that turning down font-lock-maximum-decoration from “maximum” is the right thing to do. Yep, that works: I changed it to “nil” and now I’m happy.

2 Responses to “How to disable underscore subscript in TeX mode in emacs”

  1. Andrea
    April 14th, 2009 | 10:18 pm

    Hi!
    Exactly the same situation (and the same feeling about the thing).
    I was searching again after a few days. The first time it occurred to me, what I found was solving the issue is the tip here:

    http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/bfc9141338bde20b

    namely, the
    (eval-after-load “tex-mode” ‘(fset ‘tex-font-lock-suscript ‘ignore))
    thing.

    You may like this solution more, if you wanted to disable the lock-suscript stuff alone, and are not concerned with the (presumably more global) lock-decoration variable.

    bests
    andrea

  2. blacksheep
    November 18th, 2009 | 4:19 pm

    Thanks! works great for me