简体   繁体   English

在C#中使用数学符号显示方程式

[英]Displaying equations using mathematical notation in C#

I have a very simple application that is generating equations, very simple ones, like 我有一个非常简单的应用程序,生成方程式,非常简单的,如

  • 4 + 5 = x
  • x + 4 = 12
  • 15 / x = 3
  • x^2 = 4
  • sqrt(6) = x

When I display it to myself equations like x + 4 = 12 is fine, I can read it pretty well but it would be nice if x^2 = 4 would be displayed as it x 2 = 4. It does not have to be as image, it could be anything else, but it should be so user can understand the equation. 当我向自己显示像x + 4 = 12这样的方程式很好时,我可以很好地阅读它,但如果x^2 = 4会显示为x 2 = 4,那就太好了。它不一定像图像,它可能是其他任何东西,但应该是这样,用户可以理解方程式。

Is there is some library that can help me with that? 是否有一些图书馆可以帮助我?

You could add a MathML library to your application. 您可以将MathML库添加到您的应用程序中。 This is a general math formatting library. 这是一个通用的数学格式库。 MathML in C# The examples also include non-xml defined equations. C#中MathML示例还包括非xml定义的方程式。

Another library you could be looking for should be LaTeX for C#, although, I'm not sure if this has been written yet. 您可能正在寻找的另一个库应该是LaTeX for C#,但是,我不确定这是否已经写好了。

The second link provided by Jason Down Pretty printing math in C# desktop application will probably do what you want, although you should be prepared to get your hands dirty with P/Invoke. 由Cason 桌面应用程序中的Jason Down Pretty打印数学提供的第二个链接可能会做你想要的,尽管你应该准备好用P / Invoke弄脏你的手。

Another alternative for you would be to express your equations in MathML, find a web browser which supports MathML, render them in there, and then print them from within the browser or take screenshots of them. 另一种选择是在MathML中表达你的方程,找到一个支持MathML的网络浏览器,在那里渲染它们,然后在浏览器中打印它们或截取它们的截图。

You may want to look into the Unicode character set to display things like power of two or square root. 您可能希望查看Unicode字符集以显示诸如2的幂或平方根之类的内容。 It would be limited to existing characters but otherwise pretty simple. 它将仅限于现有字符,但非常简单。 You would need to take care that the font displays the characters in question (Arial Unicode MS displays the complete set and comes with Windows 7). 您需要注意字体显示有问题的字符(Arial Unicode MS显示完整集并随Windows 7一起提供)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM