Skip to content

LaTeX annotations

A LaTeX annotation places a typeset equation on the canvas, such as ΔG = ΔH − TΔS beside an energy diagram, or an equilibrium constant under a reaction arrow. Molkit typesets your input with MathJax and places it on the canvas as vector graphics, so it stays sharp at any zoom and in exports.

The input is math-mode TeX: write \frac{a}{b} or \Delta G = \Delta H - T\Delta S directly, with no $...$ delimiters and no document preamble. For words inside an equation, use \text{...}; for chemical formulas and reactions, use \ce{...} (mhchem).

The acid dissociation constant typeset as an equation: K sub a equals the concentration of H3O+ times the concentration of A- over the concentration of HA.
An equation annotation, typeset by MathJax in STIX 2.
  1. Click the LaTeX tool in the toolbar (the summation icon) or press M.
  2. Click the canvas where the equation should go. If the grid is on, the point snaps to the grid. The editor opens.
  3. Type the equation and press Ctrl+Enter to insert it. (Esc cancels.)

After the insertion, Molkit switches to the Select tool and selects the new annotation.

Insert > LaTeX Equation… opens the same editor and places the result at the center of the view.

The editor shows a preview that updates about 300 ms after you stop typing. MathJax errors appear in the preview, so you can correct the syntax before inserting. A layout toggle in the header places the input and the preview one above the other or side by side.

A derivation with several steps can also become an animation that plays one line at a time. Select Insert > Import LaTeX Solution… (Ctrl+Shift+L), which opens this editor with the Animate derivation (step-by-step) checkbox already selected, or select that checkbox yourself. When you paste the steps as an align* block, the insert button changes to Import Animation. Molkit checks what each line does to the one before it and adds a caption to every step. See LaTeX solutions for the whole workflow.

Tabs below the input insert common fragments at the cursor:

  • Math: \frac{}{}, \sqrt{}, sums, integrals, limits, matrices, and align and cases environments
  • Greek: lowercase and uppercase letters such as \alpha, \Delta, and \Sigma
  • Arrows: \rightarrow, \Rightarrow, \xrightarrow{}, and others
  • Accents: \hat{}, \vec{}, \overline{}, and braces
  • Chem: mhchem fragments such as \ce{H2O}, \ce{<=>}, and \pu{kJ/mol}

The Recent tab holds your last 10 inserted equations. The gear button lists the available LaTeX packages: base, ams, color, and newcommand are always loaded; mhchem, cancel, physics, mathtools, braket, and several others load automatically the first time you use them. To load any other extension, write \require{package} in the input.

An equation can come from a shared .mkit file, so Molkit does not run commands that add links, styles, or raw markup to the page. When the input contains one, the preview shows the refused command as an error instead of the equation.

Commands What happens
\href, \url, \style, \cssId, \html, \data, \unicode, \mmlToken, \gdef, \global, \texttip, \mathtip, \toggle Refused.
\class, \require, \bbox Allowed with plain arguments only: a class name such as \class{mjx-molar}{M}, a package name such as \require{cancel}, and \bbox options of color, padding, and border. Any other argument is refused.
\newcommand, \renewcommand, \def Allowed, but a definition lasts for one equation only. To use a macro in several equations, define it in each one.

The font list offers 11 MathJax font sets, including STIX 2 (the default), Computer Modern, Latin Modern, DejaVu, Fira, and TeX Classic. Molkit keeps your choice for later equations, and an equation you reopen keeps its own font. A LaTeX solution animation also keeps its own font; see Fonts in an animation.

Two swatches set the color of the equation and a background fill (transparent by default). The preview updates immediately, and each swatch has a reset button. The color change applies only to black glyphs, so explicit \color{red}{...} markup keeps its color.

To save the previewed equation outside the canvas, use the buttons in the footer: Copy copies it to the clipboard as PNG, and Export downloads it as an SVG or PNG file.

To edit an equation, double-click it with the Select tool, or right-click it and select Edit LaTeX Equation…. The editor opens with its source, font, and colors. Click Update to render it again; if you resized the annotation, the new render keeps your scale.

To resize an equation, drag its selection handles. LaTeX annotations always scale proportionally, so the typesetting is never stretched. The properties panel adds width and height fields with an aspect ratio lock, an opacity slider, an optional border with color and width controls, and an Edit LaTeX… button that opens the editor in the same way as a double-click.

Equations pass through SVG export as vector graphics. If exported text must look the same on every computer, see Font embedding.