MathJax

Numbers matter just as much as words.

Preview formulas with MathJax

By turning on MathJax in Marked 2 Preferences (⌘,), under the Style pane, the necessary scripts will be included in the preview. Then MultiMarkdown math syntax can be used in your Markdown document and the results will be displayed.

Example MMD MathJax syntax:

\\[ {e}^{i\pi } 1=0 \\]

If you choose to include MathJax in an exported HTML file, a CDN link will be used instead of the embedded MathJax code. This requires an Internet connection to view the rendered MathML.

Configuration

All of the available configuration presets can be chosen from the dropdown next to the MathJax checkbox. Use these to accomodate various formula styles, LaTeX features, and rendering options.

Additional MathJax configuration

You can apply additional custom configurations on top of the selected preset by adding a valid JavaScript string in the “Additional MathJax Config” field. This field should contain everything that would normally go inside of a MathJax.Hub.Config() call. For example, the field could contain:

{
    "HTML-CSS": {
        messageStyle: "normal",
        linebreaks: {
            automatic: false
        }
    },
    tex2jax: { 
        inlineMath: [["$","$"],["\\(","\\)"]], 
        displayMath: [["$$","$$"],["\\[","\\]"]], 
        processEscapes: true
    },
    TeX: {
        Macros: {
            tr: "{\\scriptscriptstyle\\mathrm{T}}",
        }
    }
}

This would turn on MathJax feedback display, disable automatic linebreaks, and define surrounding $ as valid inline equation notation in addition to \(equation\), and $$ for display math. You can also add LaTeX macros, as shown in the TeX property. With these settings, all of the following renders properly:

Inline formula using parens, \\({x}^{2} {y}^{2}=1\\), or with dollar signs, ${x}^{2} {y}^{2}=1$.

Display with escaped brackets:

\\[ {e}^{i\pi } 333=0 \label{testme} \\]

Or with double dollar signs:

$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$

The additional configuration extends the existing object, so only the properties specified will be overridden. Unspecified options will remain at the default for the current preset.

Note that using the MultiMarkdown processor with non-standard delimiters, characters inside the expression are parsed, so symbols like * and ^ will cause typographic changes that will break the MathJax processor. The best solution in these cases is to use the Discount (GFM) processor in Processor preferences.


Search | Support Site | Knowledgebase