Follow

I export orgmode to my blogs. However, when I have an underscore (like in a section header) it is interpreted as putting the next thing in a subscript. There are plenty of answers out there for disabling this globaly or for the whole file, but I WANT subscripts sometimes. How do I tell it to leave just a particular _ alone when I export?

reddit.com/r/emacs/comments/vx

@worldsendless

I’m not an Emacs guy, but here are some ideas…

- substitute the underscore with some other character, like a dash, when you export (e.g., by piping through tr), you could do this selectively/programatically

- have the export code add markup to indicate that strings with an underscore should be treated literally by the blog (I don’t know which blog you’re using but it’s usually something like ‘<code>’ or ‘<nowiki>’ or something like that

- or do a global search/replace on the file before exporting to do one of the above

@Pat those are right along the lines I was thinking!

1 is what I am already doing with my tags, since orgmode tags (space not allowed) get converted to hugo tags (space fine), so I actually use another char in orgmode and interpret it as a space when converting.

2 That is the working solution I came to. In orgmode, surrounding by = does just that; I hadn't thought of using it for my underscore situation before this solution, though.

3 Occasionally I have done this, using some similar-looking utf8 character instead of an actual underscore. This feels dirty and might break stuff at some point, but it works for now if necessary.

Cool to totally agree in practice with what you suggested!

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.