You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently superscripts can be inserted either using LaTeX blocks, or by manually inserting <sub> and <sup> HTML elements. Are there any alternative (easier) methods by which I can achieve this?
For instance, Typora uses x^2^ for superscripts and x~2~ for subscripts in markdown files. How would I have these dispaly as superscripts and subscripts in generated webpages?
Thanks.
The text was updated successfully, but these errors were encountered:
Yes you're right and no there are no alternative methods. The way I'd do it currently is one of the following:
inserting raw html as you said
creating a \sub and \sup command which insert raw html (e.g. \newcommand{\sup}[1]{~~~<sup>~~~#1~~~</sup>~~~})
writing the subscript within a KateX block (e.g. $\text{foo}^\text{bar}$ or if it's just maths $x^2$ or x$^2$ if you don't want a different font)
It is possible to extend the parser but in that case I would prefer the LaTeX style abc^{def}. Though in LaTeX they allow this only in math mode which would amount to doing x$^2$. Allowing this in non math mode is a little tricky because the natural symbol for subscript is _ but there's ambiguity between that and emphasis i.e. x_2_3 at the moment will be x<em>2</em>3 and would be ambiguous with x<sub>2<sub>3</sub></sub>.
Lastly, could you give me a couple of examples of what you'd like? one thing is that if you're always doing this for maths, then doing it within a $..$ is probably better; or if you're always using the same combination like name<sup>TM</sup> then it's probably easier to just create a command for that like \tm. Anyway if you can think of a common use case where this would be helpful for you there may be other ways that might work nicely and wouldn't require a change to the parser 😄
Thanks.
I think I'll use \sub and \sup commands as you mentioned.
My most common use case is for writing chemical compounds and chemical reactions. In the editor I use (Typora) I can write, O~2~ for a subscripted 2. I could use $O_2$, but that would change the font of O, and O$_2$ similarly.
Currently superscripts can be inserted either using LaTeX blocks, or by manually inserting
<sub>
and<sup>
HTML elements. Are there any alternative (easier) methods by which I can achieve this?For instance, Typora uses
x^2^
for superscripts andx~2~
for subscripts in markdown files. How would I have these dispaly as superscripts and subscripts in generated webpages?Thanks.
The text was updated successfully, but these errors were encountered: