Skip to content

TK-21st/latex-to-myst

Repository files navigation

LaTeX to MyST Pandoc Filter

Latex-to-MyST implements a pandoc filter that converts a subset of LaTeX environments to MyST directives. Although it is probably more pandoc compatible to write a custom pandoc writer instead of using RawBlocks and RawInline to mimics one, the existence of panflute makes it much easier for python developers like me to work with filters instead of writers.

To use this filter, install the package by:

pip install latex_to_myst

which adds a cli latex2myst, which can be used to convert latex file to myst by calling:

latex2myst latex_file.tex markdown_file.md

LaTex Environments to MyST Directives

Latex-to-Myst Current supports:

  1. All amsthm blocks,
  2. Display Math
  3. Subplots in the form of {list-table}.

Many LaTeX environments need to be converted in to MyST directives. amsthm for example, can be visualized using the experimental Sphinx-proof Directives.

Unfortunately, MyST does not have native support for subplots, and neither does pandoc. To circumvent the problem, the best solution for now is to use a {list-table} directive. However, this still needs to be fixed as there are some known issues that need to be addressed.

Work in Progress / Known Issues

There are some known issues need to be addressed.

Credits

This module uses panflute heavily.