Pretty printing math in C# desktop application
Asked Answered
C

3

7

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?

Collaboration answered 2/2, 2011 at 17:24 Comment(1)
You should add some more information. What is the desired format (on screen or pdf dump). Why do you think HTML output would be slow. How complex are the math equations etc. With an example (screenshot from paint) this question would be much clearer.Kisor
N
3

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.

Nippur answered 2/2, 2011 at 17:41 Comment(0)
B
0

You can use MEEL for WinForms. It realy easy to use.

Bugloss answered 20/7, 2013 at 18:38 Comment(0)
S
0

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+.

Sparry answered 8/2, 2016 at 0:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.