Skip to content

LaTeX rendering for equations #11

Closed

Description

@k-deeley

Would it be possible to add stages to render both in line and separated latex code blocks for mathematical expressions?

Using the $ and $$ tags in .md and same syntax is supported in MATLAB markup rendering and github .md rendering.

Does this need an extra postprocessing script in JS?

My solution attached with a test example. Workflow for modifying images into either the md or generated html after docconvert.

testEquationFile.md

generateEquationImage.zip

Activity

  1. ebenetce commented on May 14, 2026

    @ebenetce
    Member

    A possible soluition is to inject this into the HTML

        <script>
        window.MathJax = {
        tex: {
        inlineMath: [['$', '$'], ['\\(', '\\)']],
        displayMath: [['$$', '$$'], ['\\[', '\\]']]
        }
        };
        </script>
        <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
  2. ebenetce commented on May 15, 2026

    @ebenetce
    Member

    At the moment the best is to define

    mathjax-config.js

    // MathJax configuration
    window.MathJax = {
        tex: {
        inlineMath: [['$', '$'], ['\\(', '\\)']],
        displayMath: [['$$', '$$'], ['\\[', '\\]']]
        }
        };
    
    // Dynamically load MathJax
    (function () {
    const script = document.createElement('script');
    script.src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
    script.async = true;
    document.head.appendChild(script);
    })();

    And pass it to docconvert as:

    doconvert(Scripts="path/to/matjhjax-config.js")

    This solves the problem.

  3. self-assigned this
    on May 28, 2026
  4. linked a pull request that will close this issueAdded LaTeX support via MathJax #24on May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions