71

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?

zpinter
  • 2,232
  • 2
  • 23
  • 29
  • 2
    `org-toggle-pretty-entities` for ppl where subscripts are annoying (or desired) directly inside an org doc (not related to OPs question about exporting though, just, this was a top google hit and figured I'd contribute). – Josh.F Aug 06 '19 at 06:43

7 Answers7

106

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 #

MostlyHarmless
  • 445
  • 2
  • 11
  • 21
  • 35
    you can also have '^:{}' this will still allow you to have subscript if you use curly braces, i.e. my_var won't give you subscript but F_{t} will. See also the org-mode manual: http://orgmode.org/manual/Export-options.html#Export-options – danielpoe Mar 31 '09 at 07:46
  • There are some other options not on the C-c C-e t template: #+OPTIONS: author:nil email:nil creator:nil timestamp:nil – johntait.org Mar 07 '13 at 14:53
  • 2
    Is this supposed to work in Org v.8+? It seems to have stopped working after I upgraded. – Brian Z Feb 25 '15 at 04:46
  • Corrected link from @danielpoe: http://orgmode.org/manual/Export-settings.html#Export-settings – ChrisFreeman Jun 28 '16 at 00:21
  • @danielpoe Your link is broken. – Refael Sheinker Jun 09 '23 at 04:10
38

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

(setq org-export-with-sub-superscripts nil)
zpinter
  • 2,232
  • 2
  • 23
  • 29
8

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/

justingordon
  • 12,553
  • 12
  • 72
  • 116
6

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

For example:

text\under{}text
ryanyuyu
  • 6,366
  • 10
  • 48
  • 53
Babak
  • 61
  • 1
  • 1
5

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.

Will Robertson
  • 62,540
  • 32
  • 99
  • 117
4

For individual cases, insert a literal underscore this way:

text text one\textunderscore{}two text
Robbie Morrison
  • 159
  • 2
  • 4
0

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.

xji
  • 7,341
  • 4
  • 40
  • 61