9

On a new install, I noticed that Emacs systematically lowers or raises what it identifies as subscripts or superscripts (sometimes correctly, sometimes incorrectly...) due to the presence of _ or ^ in latex-mode. Syntax highlighting is enough for me, and I do not want Emacs to do any WYSIWYG mess, so I need to deactivate this.

I found several old notes that addressed other causes of this, and tried them all, but it seems my issue is a different one.

I have GNU emacs-25.2.1 (under Linux gentoo). I am not using any of the "advanced modes" (yatex, auctex) as they do even more visual things that I do not like. I am just using the stock latex-mode, which used to be fine for my purpose.

Stefan
  • 26,404
  • 3
  • 48
  • 85
Xavier
  • 91
  • 3

2 Answers2

7

You're looking for tex-fontify-script, which you can customize, or just set manually via:

(setq tex-fontify-script nil)
Stefan
  • 26,404
  • 3
  • 48
  • 85
  • 1
    +1 - though you need to set it to nil instead of t to get rid of the funky subscripts and superscripts. – Stephen May 18 '18 at 12:49
  • 2
    In addition to set tex-fontify-script to nil, I also had to change font-latex-fontify-script and set it to nil. – Olivier Oct 02 '18 at 07:31
  • @Olivier: that's only if you're using font-latex (which comes with AUCTeX, IIUC) instead of the "builtin" font-lock rules. In your case, I'd guess that setting tex-fontify-script doesn't actually have any effect. – Stefan Oct 02 '18 at 12:42
  • @Stefan. This worked for me. Thanks! Additional question: How does one get latexmode to stop highlighting the carat and underscore characters with a different color? – Chris Judge Oct 31 '20 at 20:09
1

With 26.1 on macOS Mojave, I found that the following two lines in custom-set-variables did the trick (I actually found them via the customisation browser):

 '(tex-font-script-display (quote (-0.0 0.0)))
 '(tex-suscript-height-ratio 1.0)

The first defines the amount by which the sub/superscript is lowered/raised. The second defines how tall the super/subscript characters are with respect to the default.

Simon Wright
  • 111
  • 3