# Emacs/LaTeX displays _char as a subscript in the editor

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  Minimal text example for reconstruction: \documentclass{article} \usepackage{pdfpages} \begin{document} Underscore-o should not be set as subscript in the next line: \includepdf[pages={1}]{home/er/Documents/records/law/fr/om-ren/20170117_o} But it should be set as subscript in math environments like$A_o\$.
\end{document}

• I can reproduce the effect with emacs -Q GNU Emacs 25.1.50.2. 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 at 12:55

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.
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.
• @Erwann If Xviewer is the name of the executable then Command should be Xviewer %o and Viewer Executable should be Xviewer. – Tobias Jul 18 at 23:59