Enable mathematical typesetting via Extras->Mathematical Typesetting. The following syntax is supported:

  • AsciiMath between `, eg. `a^2+b^2 = c^2`
  • LaTeX between $$, eg. $$\sqrt{3×-1}+(1+x)^2$$
  • Inline LaTeX between \( and \), eg. \(\sqrt{3×-1}+(1+x)^2\)

Here is an example.

If the math is not converted, try clicking the </> button in the toolbar to show hidden HTML tags. This feature is not available in Confluence Server, draw.io offline and draw.io for Chrome OS. It should only be used if the diagram contains mathematical typesetting as it affects rendering performance. MathJax is used for rendering.

Example MathJax in draw.io

To change the font used for math rendering, there is an URL parameter called math-font. Possible values are STIX-Web and TeX (default).

PDF Export

For PDF export with math typesetting, if you get blank pages or shifted text labels, it may help to keep text boxes away from page borders and/or set textOverflow to fill/width as follows:

If math typesetting appears bold in a PDF export, please zoom in to make sure the cause is not your PDF viewer. See https://github.com/jgraph/drawio/issues/451#issuecomment-617607817