All Projects → ForNeVeR → Wpf Math

ForNeVeR / Wpf Math

Licence: mit
.NET library for rendering mathematical formulae using the LaTeX typsetting style, for the WPF framework

Projects that are alternatives of or similar to Wpf Math

Csharpmath
LaTeX. in C#. (ported from the wonderful iosMath project).
Stars: ✭ 205 (-39.53%)
Mutual labels:  latex, math, formula
Upmath.me
Markdown and LaTeX online editor - create text for web with equations and diagrams
Stars: ✭ 234 (-30.97%)
Mutual labels:  latex, math
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (-42.18%)
Mutual labels:  latex, math
Latexdraw
A vector drawing editor for LaTeX (JavaFX).
Stars: ✭ 336 (-0.88%)
Mutual labels:  latex, svg
Remark Math
remark and rehype plugins to support math
Stars: ✭ 129 (-61.95%)
Mutual labels:  latex, math
Dvisvgm
A fast DVI, EPS, and PDF to SVG converter
Stars: ✭ 134 (-60.47%)
Mutual labels:  latex, svg
Katex
Fast math typesetting for the web.
Stars: ✭ 14,623 (+4213.57%)
Mutual labels:  latex, math
keisan
A Ruby-based expression parser, evaluator, and programming language
Stars: ✭ 48 (-85.84%)
Mutual labels:  formula, math
pnglatex
Create PNG Images from LaTeX Formulas
Stars: ✭ 61 (-82.01%)
Mutual labels:  formula, latex
node calculator
Create Maya node-network by entering a math-formula.
Stars: ✭ 56 (-83.48%)
Mutual labels:  formula, math
Nerdamer
a symbolic math expression evaluator for javascript
Stars: ✭ 322 (-5.01%)
Mutual labels:  latex, math
Calculatex
in progress pretty printing calculator language
Stars: ✭ 302 (-10.91%)
Mutual labels:  latex, math
Mathbin
Math pastebin with LaTeX and Markdown support
Stars: ✭ 83 (-75.52%)
Mutual labels:  latex, math
Texme
Self-rendering Markdown + LaTeX documents
Stars: ✭ 1,970 (+481.12%)
Mutual labels:  latex, math
Mathview
One stop for all Math formula and Science equation rendering in Android
Stars: ✭ 71 (-79.06%)
Mutual labels:  latex, math
Mathjax
Beautiful and accessible math in all browsers
Stars: ✭ 8,551 (+2422.42%)
Mutual labels:  latex, svg
Readme2tex
Renders TeXy Math for Github Readmes
Stars: ✭ 826 (+143.66%)
Mutual labels:  latex, formula
Algebra Latex
Parse and calculate latex formatted math
Stars: ✭ 20 (-94.1%)
Mutual labels:  latex, math
hfmath
Render LaTeX math with Hershey Fonts
Stars: ✭ 76 (-77.58%)
Mutual labels:  latex, math
Angourimath
Open-source symbolic algebra library for C# and F#. One of the most powerful in .NET
Stars: ✭ 266 (-21.53%)
Mutual labels:  latex, math

WPF-Math Build status NuGet

WPF-Math is a .NET library for rendering mathematical formulae using the LaTeX typsetting style, for the WPF framework.

Getting Started

The simplest way of using WPF-Math is to render a static formula in a XAML file as follows.

<Window ... xmlns:controls="clr-namespace:WpfMath.Controls;assembly=WpfMath">
    <controls:FormulaControl Formula="\left(x^2 + 2 \cdot x + 2\right) = 0" />
</Window>

For a more detailed sample, check out the example project. It shows the usage of data binding and some advanced concepts.

Screenshot of example project

Using a rendering API

The following example demonstrates usage of TexFormula API to render the image into a PNG file using the RenderToPng extension method:

using System.IO;
using WpfMath;

namespace ConsoleApplication2
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            const string latex = @"\frac{2+2}{2}";
            const string fileName = @"T:\Temp\formula.png";

            var parser = new TexFormulaParser();
            var formula = parser.Parse(latex);
            var pngBytes = formula.RenderToPng(20.0, 0.0, 0.0, "Arial");
            File.WriteAllBytes(fileName, pngBytes);
        }
    }
}

If you need any additional control over the image format, consider using the GetRenderer API:

using System;
using System.IO;
using System.Windows.Media.Imaging;
using WpfMath;

namespace ConsoleApplication2
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            const string latex = @"\frac{2+2}{2}";
            const string fileName = @"T:\Temp\formula.png";

            var parser = new TexFormulaParser();
            var formula = parser.Parse(latex);
            var renderer = formula.GetRenderer(TexStyle.Display, 20.0, "Arial");
            var bitmapSource = renderer.RenderToBitmap(0.0, 0.0);
            Console.WriteLine($"Image width: {bitmapSource.Width}");
            Console.WriteLine($"Image height: {bitmapSource.Height}");

            var encoder = new PngBitmapEncoder();
            encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
            using (var target = new FileStream(fileName, FileMode.Create))
            {
                encoder.Save(target);
                Console.WriteLine($"File saved to {fileName}");
            }
        }
    }
}

You may also pass your own IElementRenderer implementation to TexFormula.RenderFormulaTo method if you need support for any alternate rendering engines.

Documentation

Build and Maintenance Instructions

Build the project using .NET Core SDK 3.1. WPF-Math requires C# 8 and F# 4.7 support. Here's the build and test script:

$ dotnet build --configuration Release
$ dotnet test

To approve the test results if they differ from the existing ones, execute the scripts/approve-all.ps1 script using PowerShell or PowerShell Core.

To publish the package, execute the following command:

$ dotnet pack --configuration Release

History

The library was originally ported from the JMathTex project, copyright 2004-2007 Universiteit Gent. The port was originally named WPF-TeX and was written and maintained by Alex Regueiro. It was later available as WPF-Math on Launchpad, but was unmaintained from 2011 until it was revived in its current form.

License Notes

The project code and all the resources are distributed under the terms of MIT license.

The fonts cmex10.ttf, cmmi10.ttf, cmr10.ttf, and cmsy10.ttf and cmtt10.ttf are under the Knuth License.

WPF-Math started as a direct port of JMathTeX project written in Java, reusing both code and resources. JMathTeX is distributed under the terms of GNU GPL v2 license. WPF-Math, being a derived work, has a permission from JMathTeX authors to be redistributed under the MIT license. See the Licensing history for the details.

We're very grateful to JMathTeX authors for their work and allowing to redistribute the derived library. JMathTeX is written by:

  • Kris Coolsaet
  • Nico Van Cleemput
  • Kurt Vermeulen
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].