Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

library for visualizing mathematical equations (like an equation editor) [closed]

Tags:

c#

math

I'm looking for a c# library that will provide me with equation editor functionality. I'm not looking for a mathematics library to evaluate mathematical expressions.

Any suggestions?

like image 473
Amichai Avatar asked Feb 16 '11 04:02

Amichai


People also ask

Does Word 365 have Equation Editor?

The equation converter is only available for Microsoft 365 or Office 2019. While your equations should still display correctly, in order to edit them you would need to either: Upgrade to Microsoft 365 or Office 2019, then you can use the equation converter. Download and install MathType from Wiris.

Does LibreOffice have an Equation Editor?

The neat equations and formulas editorMath is LibreOffice's formula editor, and can be invoked in your text documents, spreadsheets, presentations and drawings, enabling you to insert perfectly formatted mathematical and scientific formulas.

Is there a free version of MathType?

MathType is currently a free add-in that can be utilized in Microsoft Word, Excel, and PowerPoint. While MS Word provides some math creation tools built in, MathType is the preferred method as it offers greater accessibility. To install MathType go to the Insert tab in Word and select Get Add-ins in the Add-ins group.


2 Answers

I'd recommend to use my fork of WPF-Math. I've contacted the original WPF-Math author and now officially maintaining the library for the modern frameworks. It's in a pretty good shape, actually.

It's an important, but not full solution, because WPF-Math is only a render, but not the full formula editor.

like image 79
ForNeVeR Avatar answered Sep 18 '22 16:09

ForNeVeR


A few options exist:

wpf-math this is an API to render math based TeX to WFP, and there some limited code to take an Expression and convert it to TeX.

Another option is to use MS Word, which has some quite advanced capabilities to take regular math formulas, as simple strings, and render them in nice formatting. Here's some code to play w/ that feature.

public class FormulaImageConverter: IDisposable
{
    private Guid _guid;

    private Application _wordApp;
    private Document _doc;
    private Range _range;

    private string _saveName;
    private string _extractPath;

    public FormulaImageConverter(Application wordApp)
    {

        _wordApp = wordApp;
        _guid = Guid.NewGuid();
        string guidToString = _guid.ToString("N");
        string saveNameBase = System.IO.Path.Combine(System.IO.Path.GetTempPath(), guidToString);
        _saveName = saveNameBase + ".html";
        _extractPath = saveNameBase + @"_files\image002.gif";

        _wordApp.Visible = false;
        _doc = _wordApp.Documents.Add();
        _range = _doc.Range();
        _range.Text = "5";
        _doc.OMaths.Add(_range);

    }

    public byte[] ConvertFormulaToImage(string eq)
    {
        _range.Text = eq;
        _doc.OMaths.BuildUp();
        _doc.SaveAs(_saveName, WdSaveFormat.wdFormatHTML,Type.Missing,Type.Missing,false,Type.Missing,null,false);

        return System.IO.File.ReadAllBytes(_extractPath);
    }

    public void Dispose()
    {
        _range = null;
        _doc = null;
        _wordApp.Documents.Close(WdSaveOptions.wdDoNotSaveChanges);
        ((_Application)_wordApp).Quit(false);
        _wordApp = null;
        System.IO.File.Delete(_saveName);
        for (int i = 0; i < 2; i++)
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
    }
}
like image 21
Scott Weinstein Avatar answered Sep 21 '22 16:09

Scott Weinstein