How to render a formula in WPF or WinForms
Update 2018 TL;DR; LaTEX for WPF https://github.com/ForNeVeR/wpf-math
Original question I need to have a way to draw a mathematical formula in Windows Forms or WPF. Some "FormulaTextBox" control would be exactly what I need.
I'm not asking about full implementation of LaTEX, but at least something beyond RichTextBox possibilities, with division lines, square roots, etc.
Here's a list of options, pulled from several webpages online, as well as a few similar questions on SO
- WPF-Math, a WPF library for rendering math-related TeX markup.
- gNumerator is a WinForms control that renders MathML. It is native C#, but appears to be quite old.
- Math Expressions, a commercial WinForms control for displaying and editing math equations. Note: Not free
- There's an unofficial port of JMathTex to a C# WPF control
- The Windows version of the LaTex editor Lyx uses a native library called MikTex you could take a look at. I saw mention somewhere that the
tex4ht
package renders math equations to images - MimeTex/MathTex, as you already mentioned
- You could also use a
WebBrowser
control, and just locally include one of many javascript libraries for rendering LaTex. - You could pawn off the work onto Microsoft Word (Example - requires users to have MS Word installed!)
Perhaps you can use the Wolfram Alpha API to retrieve the images.