LaTeX2Markdown

Software Screenshot:
LaTeX2Markdown
Software Details:
Version: 0.2.1
Upload Date: 14 Apr 15
Developer: Andrew Tulloch
Distribution Type: Freeware
Downloads: 69

Rating: 5.0/5 (Total Votes: 1)

LaTeX2Markdown is an AMS-LaTeX compatible converter from (a subset of) LaTeX to MathJaX compatible Markdown.

Who should use this?

Anyone who writes LaTeX documents using the AMS-LaTeX packages (amsmath, amsthm, amssymb) and wants to convert these documents to Markdown format to use with MathJaX. The outputted Markdown files can then be easily added to any web platform - Jekyll blogs, Wordpress, basic HTML sites, etc.

In short, if you seek to use MathJaX to view your LaTeX documents online, then you might be interested in this.

Demonstration

Check out tullo.ch/projects/LaTeX2Markdown for a live demonstration of the converter.

Getting Started

Installation

The project is available on PyPI, so getting it is as simple as using

pip install latex2markdown

or

easy_install latex2markdown

Usage

The utility can be called from the command line, or from within a Python script.

For the command line, the syntax to convert a LaTeX file to a Markdown file is as follows:

python latex2markdown.py path/to/latex/file path/to/output/markdown/file

For example, to compile the example LaTeX document, call

python latex2markdown.py examples/latex_sample.tex markdown_example.tex


To use it within a Python script, use it as follows:

import latex2markdown
with open("latex_file.tex", "r") as f:
 latex_string = f.read()

l2m = latex2markdown.LaTeX2Markdown(latex_string)

markdown_string = l2m.to_markdown()

with open("markdown_file.md", "w") as f:
 f.write(markdown_string)


Finally, add the following snippet to your HTML when loading this document.

< script type="text/x-mathjax-config" >
 MathJax.Hub.Config({
 extensions: ["tex2jax.js", "AMSmath.js"],
 jax: ["input/TeX", "output/HTML-CSS"],
 tex2jax: {
 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
 displayMath: [ ['$$','$$'], ["\[","\]"] ],
 processEscapes: true
 },
 });
< /scrip t>
< script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" >
< /script >


For a working example, have a look at the source of the tullo.ch homepage here.

Requirements:

  • Python

Similar Software

plywood
plywood

20 Feb 15

mdxflavours
mdxflavours

14 Apr 15

html2latex
html2latex

2 Jun 15

Comments to LaTeX2Markdown

Comments not found
Add Comment
Turn on images!