4

I need to stop superscript before comma - , or full stop - .. When converting the Rmd file to HTML knitr makes comma superscripted as well. Example:

example.Rmd

MyTitle
========================================================
J.Smith^1, K.John^2, H.Gone^*.

example.html

enter image description here

Let me know if this was asked before, I can't find relevant questions.

A5C1D2H2I1M1N2O1R2T1
  • 190,393
  • 28
  • 405
  • 485
zx8754
  • 52,746
  • 12
  • 114
  • 209
  • 2
    If you ever plan on running your work through pandoc subsequent to this, I would recommend using something like `J.Smith^1^, K.John^2^.` From "knitr", you can also use the `pandoc(..., format="html")` function to convert the resulting ".md" file to a pandoc-style HTML file instead. – A5C1D2H2I1M1N2O1R2T1 May 02 '14 at 09:44
  • 2
    [Related question and answer](http://stackoverflow.com/a/15779737/1270695)... and you edited the question :-) – A5C1D2H2I1M1N2O1R2T1 May 02 '14 at 09:50
  • 1
    Sorry for that! But now we have a pure R Markdown & pure pandoc solutions :) – gagolews May 02 '14 at 09:57
  • 2
    @gagolews, sorry for what? Your answer definitely adds to the answer that was already available, so nothing to be sorry about :-) – A5C1D2H2I1M1N2O1R2T1 May 02 '14 at 11:26

1 Answers1

8

You may insert HTML tags directly to Markdown documents. To toggle the "superscripting" mode, use sup.

MyTitle
========================================================

J.Smith<sup>1</sup>, K.John<sup>2</sup>, H.Gone<sup>*</sup>.

EDIT: You may also use round brackets to indicate exactly the part of text to be reformatted.

J.Smith^(1), K.John^(2), H.Gone^(*)

EDIT: This has changed for Markdown V2

2^10  
2^(10)  
2^10^  
2^(10)^  

enter image description here

zx8754
  • 52,746
  • 12
  • 114
  • 209
gagolews
  • 12,836
  • 2
  • 50
  • 75
  • 1
    +1 for these options. They are the most direct approaches if you are going to be outputting to HTML. However, neither work very nicely if your final intention is PDF or another format. – A5C1D2H2I1M1N2O1R2T1 May 02 '14 at 09:49
  • Thanks for comments and answers, final intended output is HTML. – zx8754 May 02 '14 at 10:22