Skip To Article

The majority of our authoring documentation is on the MyST markup language, however, the mystmd CLI also supports the parsing and rendering of LaTeX documents and included snippets. Supporting LaTeX streamline the transition for authors who are familiar with LaTeX and allows them to publish their work in web-based formats.

Authors can write and edit in LaTeX, then utilize MyST to generate dynamic web content or structured outputs without altering the original LaTeX source. This MyST parsing of LaTeX is fast compared to traditional LaTeX compilers[1] and this speed of rendering means instant previews and fast feedback to what you are writing. Additionally, as MyST is developed entirely in JavaScript, MyST’s LaTeX parser and renderer can operate client-side, opening new possibilities for web-based LaTeX editing and rendering applications.

Getting Started

To begin rendering LaTeX documents with MyST, first install the MyST CLI. Navigate to your project directory containing LaTeX (*.tex) files and execute the commands myst init followed by myst start. This launches a dynamic web server that renders your LaTeX content in near real-time, with comprehensive error reporting for issues such as unrecognized macros or any other math rendering problems.

The MyST server will serve the preview of your document and show live changes.

Figure 1:The MyST server will serve the preview of your document and show live changes.

Approach

To understand the limitations of using LaTeX with MyST, here we spend some time explaining the approach. MyST is a stand-alone LaTeX\LaTeX parser and renderer. The @unified-latex library is used for parsing *.tex files, and includes rich information about source-code positions which are used in the error messages. This token stream has some information about basic commands, but is primarily focused on the structure of the markup — arguments, brackets, nesting, whitespace. The parse step uses tex-to-myst to convert this token stream into an abstract syntax tree (AST), which is transformed as usual.

Figure 2:The process of parsing and rendering LaTeX with MyST. The LaTeX content can be transformed into other modern PDF renders such as Typst or rendered online with the current MyST content.

Limitations

While MyST effectively handles a wide range of LaTeX documents, particularly scientific articles, it is not a full LaTeX renderer and is not aspiring to be one. As such, there will always be limitations on this approach, however, we believe supporting LaTeX is effective as a transition towards semantic and web-first authoring approaches like MyST Markdown.

Supported Environments and Macros

The following packages are supported and includes common typography, figures, tables, code and algorithms. The MyST team will extend functionality for highly-used packages and conventions, if you have a package that you think we should support, please open an issue.

LaTeX Macros
  • \newline
  • \par
  • \break
  • \\
  • \newpage
  • \clearpage
  • \pagebreak
  • \FloatBarrier
  • \usepackage
  • \newcommand
  • \renewcommand
  • \providecommand
  • \date
  • \maketitle
  • \tableofcontents
  • \appendix
  • \title
  • \author
  • \thanks
  • \affil
  • \affiliation
  • \email
  • \keywords
  • \newtheorem
  • \Author
  • \textbf
  • \emph
  • \textit
  • \texttt
  • \textsc
  • \textsubscript
  • \textsuperscript
  • \hl
  • \cancel
  • \bcancel
  • \xcancel
  • \bf
  • \em
  • \ttfamily
  • \textrm
  • \color
  • \textcolor
  • \definecolor
  • \label
  • \ref
  • \subref
  • \nameref
  • \pageref
  • \autoref
  • \eqref
  • \cref
  • \item
  • \itemsep
  • \href
  • \hyperlink
  • \url
  • \hyperref
  • \hypertarget
  • \epigraph
  • \cite
  • \citet
  • \citep
  • \citealp
  • \citeauthor
  • \citeyear
  • \citeyearpar
  • \citenum
  • \Citet
  • \Citep
  • \Citeauthor
  • \`
  • \'
  • \^
  • \"
  • \H
  • \~
  • \c
  • \k
  • \l
  • \=
  • \.
  • \d
  • \r
  • \u
  • \v
  • \t
  • \o
  • \i
  • \%
  • \$
  • \&
  • \{
  • \}
  • \_
  • \P
  • \dag
  • \ddag
  • \textbar
  • \textgreater
  • \textless
  • \textendash
  • \textemdash
  • \texttrademark
  • \textregistered
  • \copyright
  • \textexclamdown
  • \textquestiondown
  • \pounds
  • \euro
  • \#
  • \S
  • \textbackslash
  • \textcelsius
  • \degreeCelsius
  • \celsius
  • \aa
  • \AA
  • \dots
  • \ldots
  • \texttimes
  • \textellipsis
  • \textdegree
  • \degree
  • \textasciitilde
  • \textvisiblespace
  • \
  • \,
  • \section
  • \subsection
  • \subsubsection
  • \paragraph
  • \subparagraph
  • \centering
  • \includegraphics
  • \caption
  • \captionof
  • \framebox
  • \bibliography
  • \bibliographystyle
  • \mbox
  • \and
  • \input
  • \noindent
  • \acknowledgments
  • \def
  • \arraystretch
  • \vspace
  • \hfill
  • \tiny
  • \small
  • \footnotesize
  • \normalsize
  • \large
  • \Large
  • \LARGE
  • \huge
  • \bgroup
  • \egroup
  • \textwidth
  • \onecolumn
  • \linewidth
  • \linenumbers
  • \nolinenumbers
  • \setcounter
  • \tnote
  • \resizebox
  • \makecell
  • \multirow
  • \multicolumn
  • \footnote
  • \footnotemark
  • \footnotetext
  • \SI
  • \si
  • \qty
  • \unit
  • \ang
  • \ce
  • \Loop
  • \For
  • \ForAll
  • \State
  • \Ensure
  • \Require
  • \Repeat
  • \Until
  • \While
  • \EndWhile
  • \EndFor
  • \EndLoop
  • \If
  • \ElsIf
  • \Else
  • \EndIf
  • \Procedure
  • \EndProcedure
  • \Function
  • \EndFunction
  • \Comment
LaTeX Environments
  • \begin{document}
  • \begin{abstract}
  • \begin{eqnarray}
  • \begin{multline}
  • \begin{gather}
  • \begin{align}
  • \begin{alignat}
  • \begin{flalign}
  • \begin{pmatrix}
  • \begin{pmatrix*}
  • \begin{bmatrix}
  • \begin{bmatrix*}
  • \begin{vmatrix}
  • \begin{vmatrix*}
  • \begin{Vmatrix}
  • \begin{Vmatrix*}
  • \begin{subequations}
  • \begin{enumerate}
  • \begin{itemize}
  • \begin{description}
  • \begin{labeling}
  • \begin{quote}
  • \begin{quotation}
  • \begin{displayquote}
  • \begin{figure}
  • \begin{subfigure}
  • \begin{wrapfigure}
  • \begin{centering}
  • \begin{figure*}
  • \begin{center}
  • \begin{minipage}
  • \begin{adjustwidth}
  • \begin{landscape}
  • \begin{table}
  • \begin{table*}
  • \begin{tabular}
  • \begin{tabularx}
  • \begin{supertabular}
  • \begin{longtable}
  • \begin{longtable*}
  • \begin{threeparttable}
  • \begin{tablenotes}
  • \begin{adjustbox}
  • \begin{algorithm}
  • \begin{algorithmic}

Error Reporting

MyST improves upon traditional LaTeX error messaging by providing specific, actionable feedback. Error messages include line and column numbers for direct navigation to issues, significantly reducing troubleshooting time. This feature, coupled with the ability to render partial documents despite errors, can ensures a smoother writing and revision process.

Error messages and warnings are specific and actionable using MyST.

Figure 3:Error messages and warnings are specific and actionable using MyST.

Footnotes
  1. The entire rendering process can run in a few hundred milliseconds from start to finish rather than around 3-10 seconds for small documents using common renderers. The papers we were testing while writing these docs are about ⚡️ 16 times faster ⚡️ - which is significant, and there is lots of room for improvement in MyST as well!

MyST MarkdownMyST Markdown
Community-driven tools for the future of technical communication and publication, part of Jupyter.