The question is as follows. You need a string in which the formula, something like

T ^ (A + B + Abc)

you don't want to leave it in this form, you want to be civilized, understandable for reading, as in the same Word, for example. So, break everything that you can and find only Unicode characters for individual cases, I ask you - how can you format a string in C # in this form? Are there any control sequences or something else? There are tags in html and there must be something in C # too, if this is how it is done in MS Office

    1 answer 1

    You have to do a good job. For example, a more or less adequate code for your WPF case is:

    <Window x:Class="YourNamespaceHere.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="Typography" Height="350" Width="525"> <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock FontFamily="Palatino Linotype" FontSize="24"> <Italic>T</Italic><!-- --><Span Typography.Variants="Superscript"><!-- -->(<Italic>A</Italic>&#x200a;+&#x200a;<!-- --><Italic>B</Italic>&#x200a;+&#x200a;<!-- --><Italic>Abc</Italic>)</Span> </TextBlock> </Grid> </Window> 

    He gives this:

    rendering math

    Details:

    • You need an Open Type font, for example, Palatino. In other fonts typographic effects do not work.
    • Binary operations are manually repulsed by fine spells ( &#x200a; ).
    • In XAML, the spaces inside TextBlock significant, I had to comment them out. If you collect content manually in the code-behind, this is not a problem.

    If you need a really good rendering of formulas, I advise you to look at TeX. It has source code

     $T^{(A\mathop{+}B\mathop{+}Abc)}$ 

    formatted in this:

    TeX output