在WPF上标上标 [英] Superscript of superscript in WPF
问题描述
我设法使用下面的代码行,使字符上标:
I have managed to make a character superscript using the following lines of code:
Paragraph p=new Paragraph();
Span s = new Span();
s.BaselineAlignment = BaselineAlignment.Superscript;
s.Inlines.Add("2");
p.Inlines.Add(new Run("EXAMPLE 1 : Describe the behaviour of the function f(x)=(x"));
p.Inlines.Add(s);
p.Inlines.Add(new Run("-1)/(x-1) near x=1."));
但是,它可以编写一个标一标?就像下图所示:
But is it possible to write a superscript of a superscript? Like the one shown below:
g(x)=(1+x^2)^(1/x^2)
下面第二^将上标上标。如何实现这一目标?
也让我知道是否有可能使程序理解 X ^ 2-1 =(X-1),(X + 1)
,以及任何类似这个方程,甚至第n次方程?
Here the second ^ will be superscript of the superscript. How to achieve this?
Also let me know is it possible to make a program understand that x^2-1 = (x-1)(x+1)
, and anything similar to this equation, even the nth degree equations?
推荐答案
您可以用Typography.Variant结合BaselineAlignment.Superscript =标是这样的:
You could combine BaselineAlignment.Superscript with Typography.Variant="superscript" like this:
<Paragraph FontFamily="Palatino Linotype">
<Run>g(x)=(1+x</Run>
<Run Typography.Variants="Superscript">2</Run>
<Run>)</Run>
<Run BaselineAlignment="Superscript">(1/x</Run>
<Run BaselineAlignment="Superscript" Typography.Variants="Superscript">2</Run>
<Run BaselineAlignment="Superscript">)</Run>
</Paragraph>
这会给你的输出是这样的:
This will give you an output something like this:
这篇关于在WPF上标上标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!