Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 455
MajesticRa Avatar asked Jan 17 '12 17:01

MajesticRa


People also ask

Which is better WinForms or WPF?

Winforms vs WPF both are mainly used for the same purpose for developing and designing windows applications, but WPF can be used for the web application. The difference between them is scalability, performance as WPF can render fast compared to windows forms, complexity, and support.

Can you mix WPF and WinForms?

Yes you can, both Windows Forms within a WPF application, and WPF controls within Windows Forms.

Is WPF harder than WinForms?

It is simple to use WinForms as controls can be used easily, it's less time-consuming and less tricky as compared to WPF.

Is WPF the same as Windows Forms?

Introduction. The abbreviation W.P.F simply refers to Microsoft's Windows Presentation Foundation, and WinForms is a simple concatenation of Windows Forms Applications. These are both Microsoft's Windows Applications Graphical User Interfaces that developers may use to develop Windows desktop applications.


2 Answers

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!)
like image 83
BlueRaja - Danny Pflughoeft Avatar answered Sep 18 '22 15:09

BlueRaja - Danny Pflughoeft


Perhaps you can use the Wolfram Alpha API to retrieve the images.

like image 28
TJHeuvel Avatar answered Sep 18 '22 15:09

TJHeuvel