I am writing software which displays a lot of mathematical content. As in windows forms it is already hard to set a subscript or a Greek letter in a label, I am thinking of switching to WPF.
At the moment I am searching for the best way to render a mathematical expression, a formula or just a symbol inside my graphical user interface. They have to be shown in labels or drawn graphs/pictures. No live/just-in-time renderings but beautiful fix symbols.
What is the best way to do that? I thought, that MathML should be supported well, but I can't find a lot regarding that. I would be glad to hear some advice.
Here is, where I can get my symbols from (or what I would prefer):
SVG
(some rendering of LaTeX in Inkscape and export to XAML)xmcd
Files (Mathcad XML Document. Don't know how, but at least it's XML)html
Files (written by LaTeX->html or Mathcad->htmlWhat I wouldn't consider personally, but maybe there are good solutions to:
png
-icons, pdf
, dvi
, eps
, svg
directly imported)I think using LaTeX, MathML or html would be great as they could be used for documentation as well. I also could think about exporting calculation results to *.tex
files or internally generate graphics completely with LaTeX (tikz, pgfplots...)
Consider using open-source WPF-Math library (disclaimer: I'm its' current maintainer).
It can help you to display the LaTeX expression in a WPF window. It also uses vector graphic instead of bitmaps, so the formulae will scale nice on the modern displays.
I would go with pure xaml approach using datatemplates. There is no need for another vector format or rednering engine. You can use datatemplate for each expression in expression tree. Using viewboxes you can achieve stretching, so topmost expressions will be larger then inner expressions. Your datatemplates will generate visual tree from you expression tree. I mean there will be contentpresenters inside contentpresenter.
The great advatage is that the expression visualisation can be responsive and interactive, just like math expression in MS Word, or Excel.
I could help you with implementation, since this is not trivial, if you are not familiar with wpf datatemplates
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With