I'm currently working on an UWP app which also deals with math. Therefore i parse formulae and display them as inlines
in a RichTextBlock
. As you can imagine, I also want to display sub- and superscription - but I haven't yet found a way to do so. I know, there is something called BaselineAlignment
in WPF, but it seems that this is not supported in UWP.
I'm currently also about to figure out how to best display fraction lines and roots. I've thought about building my own control for this purpose, but if somebody knows a better approach it would be nice to know.
I'm gladful for any answer.
Asked
Active
Viewed 510 times
1

gillesberger_p
- 75
- 1
- 8
2 Answers
1
To apply subscript and superscript to text in RichTextBlock
, we can take advantage of Typography.Variants attached property. For example:
<RichTextBlock FontSize="36">
<Paragraph FontFamily="Palatino Linotype">
2<Run Typography.Variants="Superscript">3</Run>
14<Run Typography.Variants="Superscript">th</Run>
</Paragraph>
<Paragraph FontFamily="Palatino Linotype">
H<Run Typography.Variants="Subscript">2</Run>O
Footnote<Run Typography.Variants="Subscript">4</Run>
</Paragraph>
</RichTextBlock>

Jay Zuo
- 15,653
- 2
- 25
- 49
-
Thanks! Exactly what I was looking for. – gillesberger_p Mar 05 '17 at 10:52
0
You could use a WebBrowser
control, and just locally include one of many javascript libraries for rendering LaTex.

Mark Cidade
- 98,437
- 31
- 224
- 236
-
Thought about that earlier, but given that there isn't only one formula to be shown - but, depending on type of input, quite a lot - loading a WebView for each of them doesn't seem to be the most performant way... – gillesberger_p Feb 09 '17 at 20:32