在 C# (winforms) 桌面应用程序中打印数学方程的最佳方法是什么?源的格式并不重要;我只需一点点努力就可以生成几乎任何东西。重要的是它应该具有相对较高的性能和较低的开销(我知道,我只应该选择 {性能,大小,功能}中的 2 个,但我想要全部 3 个。)
我考虑过的事情:
- LaTeX via System.处理() - > dvipng.问题:即使是最小的 LaTeX 安装也大约有 200 MB。考虑到我的应用程序目前约为 400k,我认为这有点过多。
- 某种为网络设计的基于 JS 的数学渲染库,例如 JSMath。问题:创建 HTML 输出,但仍需要在 Web 浏览器中显示。性能低(可能非常低)。
- 滚动我自己的。问题:需要花费大量时间和精力来复制前人的作品。在 C# 中绘制文本很困难。
有什么建议吗?你们中有人过去做过这种事吗?
What is the best method of printing math equations in a C# (winforms) desktop application? The format for the source is not important; I can generate almost anything with a little effort. What is important is that it should be relatively high performance and low overhead (I know, I'm only supposed to pick 2 of { performance, size, features } but I want all 3.)
Things I have considered:
- LaTeX via System.Process() -> dvipng. Problem: even a minimal LaTeX instal is about 200 MB. Considering that my app is currently ~400k I think this is a bit excessive.
- Some sort of JS-based math rendering library designed for the web, e.g. JSMath. Problem: creates HTML output, which still needs to be displayed in a WebBrowser. Low (probably very low) performance.
- Rolling my own. Problems: Takes a lot of time and effort to duplicate the works of those who have gone before. Difficult to draw text in C#.
Any suggestions? Have any of you done this sort of thing in the past?
发布评论
评论(3)
一些谷歌搜索引导我找到这篇 CodeProject 文章:它使用 MimeTex,一个从乳胶公式生成 gif 的库。您必须使用 PInvoke 才能在 C# 中使用它,但所有内容似乎都在文章中。
Some googling lead me to this CodeProject article: it uses MimeTex, a library that generates gif from latex formulas. You'll have to use PInvoke to have it in C#, but everything seems to be in the article.
您可以将 MEEL 用于 WinForms。它真的很容易使用。
You can use MEEL for WinForms. It realy easy to use.
如果可行的话,您的应用程序的一个潜在解决方案是托管一个在线活动服务器页面,您可以传递 LaTeX 标记并让它返回图像。明显的限制包括带宽、网络访问和速度。
使用 CodeProject 和 MineTex 链接将是很好的起点,从中可以实现 C#/ASP 解决方案。
然后,您可以从 winforms 发出请求并获取可以在控件中显示的图像,甚至可以使用 GDI+ 呈现的图像。
A potential solution for your application, if it is feasible, would be to host an online active server page that you could pass LaTeX markup and have it return an image. Obvious constraints include bandwidth, network access, and speed.
Using the CodeProject and MineTex links provided by CharlesB would be great starting points, from which a C#/ASP solution could be implemented.
Then, from winforms, you could make the request and obtain an image which could be displayed within a control, or even rendered using GDI+.