1

I'm writing a document (in org-mode) that quotes another document, including its footnotes. As such, I'd like to have a line like:

#+BEGIN_QUOTE
^123 The contents of footnote 123 go here.
#+END_QUOTE

And have that render as something like:

¹²³ The contents of footnote 123 go here.

But what I'm actually getting is:

^123 The contents of footnote 123 go here.

I've tried using braces around the numbers, which just gets me this:

^{123} The contents of footnote 123 go here.

And that's true even if I also set this option at the top of my file:

#+OPTIONS: ^:{}

If I put something before the superscript, it sort of works – e.g., entering:

.^123 The contents of footnote 123 go here.

... renders (within Emacs, assuming org-toggle-pretty-entities (C-C C-X \) is enabled) as:

.¹²³ The contents of footnote 123 go here.

Or, in HTML export, gives:

.<sup>123</sup> The contents of footnote 123 go here.

which renders similarly (though not identically) to the above, as:

.123 The contents of footnote 123 go here.

But I don't want that . (or anything else obviously visible) to be there (I might be OK with some whitespace, but I'd prefer not), and I'm not sure what I could put there that would be invisible, yet cause the parsing engine to actually treat things as a superscript, and/or what to do to actually tell the parsing engine to parse superscript indicators that don't have anything before them at the beginning of the line.

I've tried inserting some characters like U+00A0 (C-x 8 RETno-break spaceRET) – which works, but gives a visible space; U+2008 (C-x 8 RETzero width spaceRET) – which doesn't work; and a few other things, but none of the things I've tried so far both works to get a superscript, and leaves the output at the beginning of the line.

As mentioned, I also tried setting the ^:{} option, to no avail.

Is there a way to tell org-mode to parse ^, even at the beginning of a line, as a superscript indicator? Or at least something invisible I could put in front of the ^ that would cause it to render as superscript, while still visibly rendering as the beginning of the line?

1

This works for me:

\nbsp{}^{123} test

You might be like to define your own entity like this (this might look funny, the utf-8 actually has a utf-8 zero-space width below, and for ascii there is just no space.) :

(add-to-list 'org-entities-user
      '("zwsp"
      "\\hspace{0pt}"       ; latex
      nil             ; not in math-mode
      "&#8203;"           ; html
      ""              ; ascii
      nil                 ; latin1 not sure what to put here
      "​"             ; utf-8
      ))

then you can use it instead.

\zwsp{}^{124} with a zero width space

  • Hmm, thanks for this. That first version works, rendering &nbsp;<sup>123</sup> test in the HTML. The second one, though, I'm not sure how to get to work. I tried putting it in the scratch buffer and running it (with <kbd>C-x C-e</kbd>), and even tried the same with it directly in the org buffer. No dice. So I added it to the end of my init.el, re-started emacs, and got Symbol's value as variable is void: org-entities-user... I fixed that with (with-eval-after-load 'org, but still no joy: getting \zwsp{}<sup>123</sup> test in the HTML. Any hints? (No errors in *Messages*) – lindes May 21 at 6:37
  • Try the new version above. I think there were some parentheses bugs in the first version. – John Kitchin May 21 at 17:50
0

Well (answering my own question), I found something... For this part of the question:

Is there a way to tell org-mode to parse ^, even at the beginning of a line, as a superscript indicator?

I still don't know of anything there. Other answers that solve it in that way would be appreciated.

But, for this:

Or at least something invisible I could put in front of the ^ that would cause it to render as superscript, while still visibly rendering as the beginning of the line?

Apparently, there was a character I'd missed that works:

U+FEFF - (C-x 8 RETzero width no-break spaceRET)

It does of course leave that character (as the octets 0xEF 0xBB 0xBF, for UTF-8 encoding) in the file (so it's no longer just ASCII text), as well as in the output for HTML exports, which isn't quite ideal, but at least it renders visually within emacs as:

¹²³ The contents of footnote 123 go here.

And, on HTML export, the <sup>123</sup> equivalent:

123 The contents of footnote 123 go here.

Which is pretty close to the desired behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.