Disabling underscore-to-subscript in Emacs Org-Mode export

EmacsLatexTexOrg Mode

Emacs Problem Overview


When I export to PDF via org-mode (C-c C-e d), any words with underscores end up being partially converted to subscript. How can I prevent this from happening?

I found this article on the subject:

Disabling Underscore subscript in Emacs Tex Mode

However, I either wasn't able to figure out the correct elisp or it simply didn't work. Note, I don't want to change any global font options. I only want this fix to apply to tex/latex/org-mode.

I also found this post, though it didn't work either:

disable subscript superscript raise/lower?

Emacs Solutions


Solution 1 - Emacs

You can disable super/subscripting within an org file by adding the following line:

#+OPTIONS: ^:nil

Check the org manual for more options.
The following command inserts a template containing all the options: C-c C-e #

Solution 2 - Emacs

I was able to solve the issue by setting the following variable:

(setq org-export-with-sub-superscripts nil)

Solution 3 - Emacs

I think this would be easier: http://orgmode.org/manual/Subscripts-and-superscripts.html Escape the underscore with a backslash:

enter image description here

enter image description here

Now, escape the _:

enter image description here

enter image description here

You can see this in action here: http://www.railsonmaui.com/blog/2013/04/27/octopress-setup-with-github-and-org-mode/

Solution 4 - Emacs

Use \under (Documentation on The Org Manual: Special symbols)

For example:

text\under{}text

Solution 5 - Emacs

Do you want to prevent subscripts in the onscreen display of the source file or in the text of the output PDF? If the latter, then you want

\usepackage{underscore}

It won't break the use of underscores in maths mode, either.

Solution 6 - Emacs

For individual cases, insert a literal underscore this way:

text text one\textunderscore{}two text

Solution 7 - Emacs

In my case any word that contains an underscore is likely to be a variable name or something similar. I just surround it with = or ~ so that it's treated as such. Then it will be exported accordingly.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionzpinterView Question on Stackoverflow
Solution 1 - EmacsDon WView Answer on Stackoverflow
Solution 2 - EmacszpinterView Answer on Stackoverflow
Solution 3 - EmacsjustingordonView Answer on Stackoverflow
Solution 4 - EmacsBabakView Answer on Stackoverflow
Solution 5 - EmacsWill RobertsonView Answer on Stackoverflow
Solution 6 - EmacsRobbie MorrisonView Answer on Stackoverflow
Solution 7 - EmacsxjiView Answer on Stackoverflow