GithubHelp home page GithubHelp logo

naimurdev / mathconverter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oerpub/mathconverter

0.0 0.0 0.0 46 KB

Converts from AsciiMath, LaTeX, MathML to LaTeX, MathML

License: MIT License

Python 1.42% XSLT 98.58%

mathconverter's Introduction

Converter for AsciiMath, LaTeX & MathML equations

Converts from AsciiMath, LaTeX, MathML to LaTeX, MathML

utilizes MathMLCloud (for MathML output) and XSL transforms (for LaTeX output).

(Optional):

virtualenv env
. env/bin/activate

Install:

pip install -r requirements.txt

Usage:

./converter.py --help

Example

$ ./converter.py --equation "x^2" --iformat asciimath --oformat mathml

<math xmlns="http://www.w3.org/1998/Math/MathML" alttext="x squared">
  <mstyle displaystyle="true">
    <msup>
      <mi>x</mi>
      <mn>2</mn>
    </msup>
  </mstyle>
</math>

Known issues

Don't use bash shell confusing/specific signs like e.g. $$ or " in the commandline or escape them properly. If you're unsure how to do that, run the command without --equation like this:

$ ./converter.py --iformat asciimath --oformat mathml

it will prompt you for the equation that way.

Background information

For generating MathML it is using the public reachable MathMLCloud on https://api.mathmlcloud.org/equation which is utilizing a Node.js server version of Mathjax for generating output.

LaTeX is generated by XSLTs from MathML input.

A special case is the AsciiMath to LaTeX conversion. On the first step it generates MathML from MathMLCloud and then uses the XSLTs to generate LaTeX out of it.

MathML to LaTeX XSLTs available in this repo:

  • xsl_yarosh by Vasil Yaroshevich. Contains XSLT 1 transformation from MathML to LaTeX
  • xsl_transpect by transpect.io. Contains XSLT 2 transformations from MathML to LaTeX (not used currently)

mathconverter's People

Contributors

therealmarv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.