Stan
Stan

Reputation: 26511

Displaying equations using mathematical notation in C#

I have a very simple application that is generating equations, very simple ones, like

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 x2 = 4. It does not have to be as image, it could be anything else, but it should be so user can understand the equation.

Is there is some library that can help me with that?

Upvotes: 12

Views: 9457

Answers (3)

Mike Nakis
Mike Nakis

Reputation: 62015

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.

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.

Upvotes: 2

ILoveFortran
ILoveFortran

Reputation: 3509

You may want to look into the Unicode character set to display things like power of two or square root. 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).

Upvotes: 0

Cedric Van Goethem
Cedric Van Goethem

Reputation: 121

You could add a MathML library to your application. This is a general math formatting library. MathML in C# The examples also include non-xml defined equations.

Another library you could be looking for should be LaTeX for C#, although, I'm not sure if this has been written yet.

Upvotes: 6

Related Questions