Skip to content

Conversion of markdown files to latex files. The output is closer to the original file than a Pandoc conversion. Inclusion of macros is also possible

Notifications You must be signed in to change notification settings

lionelchg/Markdown2LaTeX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown2LaTeX

Converter from markdown file using KaTeX to .tex files. The conversion is very close to the original markdown file compared to pandoc. A related blog post can be found here.

Installation

Install the package when in the root directory (where the setup.py file is), then run:

pip install -e .

A variable environnement needs to be created to indicate where the folder md2latex/ is. In your .bashrc or .zshrc:

export MDTOLATEX_HOME=path/to/md2latex

Convert

To convert markdown files along with macros defined in KaTeX:

md2latex -f markdown_filename -m macros_filename

A demo is provided in the example/ folder. Go into the folder and execute

md2latex -f example.md -m macros.md

How does it work?

md2latex uses regex to parse the markdown file and convert the entries to LaTeX. An initial template is given to the python script (template.tex in md2latex/). As of now the following conversions are made:

  • $$..$$ and related to equation, align environments
  • Lists in 1. 2. 3. are converted to enumerate environment, - - - in itemize environment
  • Markdown tables are converted to LaTeX tables

For all these conversions to work the original markdown file must follow the standard markdown format where tables, lists and equations are surrounded by blank lines.

About

Conversion of markdown files to latex files. The output is closer to the original file than a Pandoc conversion. Inclusion of macros is also possible

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published