Disabling underscore-to-subscript in Emacs Org-Mode export
Asked Answered
E

7

72

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?

Elanorelapid answered 30/3, 2009 at 18:53 Comment(1)
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).Sharolynsharon
E
39

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

(setq org-export-with-sub-superscripts nil)
Elanorelapid answered 31/3, 2009 at 14:22 Comment(0)
T
107

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 #

Teide answered 30/3, 2009 at 19:59 Comment(5)
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: orgmode.org/manual/Export-options.html#Export-optionsBrow
There are some other options not on the C-c C-e t template: #+OPTIONS: author:nil email:nil creator:nil timestamp:nilExsert
Is this supposed to work in Org v.8+? It seems to have stopped working after I upgraded.Shagreen
Corrected link from @danielpoe: orgmode.org/manual/Export-settings.html#Export-settingsFricassee
@Brow Your link is broken.Predestinate
E
39

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

(setq org-export-with-sub-superscripts nil)
Elanorelapid answered 31/3, 2009 at 14:22 Comment(0)
G
9

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/

Greatgranduncle answered 29/4, 2013 at 8:31 Comment(7)
Sorry for offtopic, but what color scheme do you use? I quite like it.Smectic
zenburn -- awesome. Use package-list-packages. It's a bit like railscasts.Greatgranduncle
thanks! And comments must be at least 15 characters in length.Smectic
This doesn't seem to work for me in org 8.2.10, whether I'm publishing to HTML or to LaTeX/PDF. I get a backslash in the output, plus subscript text.Leonoreleonsis
this doesn't seem to work when publishing to html. using org 8.2.10m same behavior as @KenWilliams notedMalar
For submitting org bug reports follow instructions at orgmode.org/manual/Feedback.html.Bibliomania
@KenWilliams did you ever find a solution for publishing underscores to HTML?Fur
E
6

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

For example:

text\under{}text
Exserviceman answered 5/12, 2018 at 16:35 Comment(0)
M
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.

Misadvise answered 31/3, 2009 at 5:15 Comment(0)
H
4

For individual cases, insert a literal underscore this way:

text text one\textunderscore{}two text
Highminded answered 15/3, 2012 at 10:12 Comment(0)
F
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.

Fussbudget answered 13/6, 2018 at 20:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.