Emacs seems to be doing some WYSIWYG with _, as if it were in math mode (in the picture, _ is followed by subscript 'o', inside the include statement. It shouldn't. I'm using Emacs/Tex out of the box, no special configuration.

GNU Emacs 24.5.1

$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018)
kpathsea version 6.3.0

the 'o' next to '_' is displayed as a subscript inside Emacs

Minimal text example for reconstruction:

  Underscore-o should not be set as subscript in the next line:

  But it should be set as subscript in math environments like $A_o$.
  • I can reproduce the effect with emacs -Q GNU Emacs One possible solution would be to switch to AUCTeX. Therewith the argument of underscore is only set as subscript if it occurs in math environments. But I agree that AUCTeX is quite heavy. It brings a lot of features which you probably do not want. – Tobias Jul 17 '18 at 12:55

The better alternative to latex-mode from tex-mode.el is LaTeX-mode from AUCTeX. If AUCTeX is not provided by your Linux distribution you find it via package-list-packages after proper setup of package.el.

If you want to stick to latex-modefrom tex-mode.el and if you do not excessively use math in your documents you can toggle off tex-fontify-script via the customization interface. You get to the customization interface by M-x customize-option RET tex-fontify-script RET.

| improve this answer | |
  • Thanks. AUCTeX displays underscored correctly. I'm posting a new question for setting up the viewer. – Erwann Jul 18 '18 at 23:32
  • @Erwann If Xviewer is the name of the executable then Command should be Xviewer %o and Viewer Executable should be Xviewer. – Tobias Jul 18 '18 at 23:59
  • Sorry, I'm having this problem again: $\omega_1$ is displayed in the editor with 1 as underscript (WYSIWYG). I'm under AUCTeX 12.2 and I did M-x LaTeX-mode. – Erwann Mar 5 at 5:10

This is an old problem, with an answer here - just use \textunderscore keyword. Works both in LaTeX and .org files. The underscore character is reserved in LaTeX.

In Emacs:

enter image description here

The resulting .pdf:

enter image description here

| improve this answer | |

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.