MiniLatex

a Parser-Renderer for a Subset of LaTeX pdf , github

Thanks to the pioneering work of Donald Knuth in creating TeX, the subsequent development of LaTeX by Leslie Lamport, and the continued contributions of an active community of developers, those who rely on LaTeX to publish in print or as PDF have superb document creation tools.

For publishing documents with mathematical content on the web, there are a number of options. Most widely used is MathJax, which provides high-quality rendering of math-mode TeX-LaTeX for HTML pages. There are also a number of command-line tools, e.g., Pandoc, for converting LaTeX documents to HTML using embedded images for the mathematical text.

Of particular note is Daan Leijen’s Madoko, which is perhaps closest in spirit to this project. Madoko uses Koka, a typed functional language to parse and render a markdown-like language that handles mathematical formulas written in LaTeX and which can export documents to LaTeX.

The gap that MiniLatex aims to fill is to provide a tool for live-rendering both text-mode and math-mode LaTeX.

MiniLatex Demo page

The MiniLaTex Project site

~

Creating different page item types, and plugins, based on how an item is edited rather what the content is, is the road to needless complexity. To maintain simplicity a better approach would for different content editing mark-up to be supported by making the editor into a pluggable component.

> For text items it would be better to have a single item type – the text would be stored with standard way (a minimal HTML subset is suggested, so standard libraries can be used). The user should be able to select the type of mark-up they prefer to use, and be presented with an appropriate editor.

Cf. the Parser-Renderer for a Subset of LaTeX above. pdf

Towards LaTeX in the Browser hackernoon

YOUTUBE dmDA7iziSgs "Making a LaTeX-to-Html parser in elm" by James Carlson (2018)

{-| THE MAIN RENDERING FUNCTION -} render : LatexState -> LatexExpression -> String render latexState latexExpression = case latexExpression of Comment str -> renderComment str Macro name optArgs args -> renderMacro latexState name optArgs args SMacro name optArgs args le -> renderSMacro latexState name optArgs args le Item level latexExpression -> renderItem latexState level latexExpression InlineMath str -> "\\(" ++ str ++ "\\)" DisplayMath str -> "\\[" ++ str ++ "\\]" Environment name args body -> renderEnvironment latexState name args body LatexList args -> renderLatexList latexState args LXString str -> str LXError error -> ErrorMessages.renderError error

~

Why Elm is the right tool to build MiniLatex page