Supported LaTeX
This is the authoritative list of what TeXConverter converts today. If a construct isn't
listed as supported, it either throws a clear unsupported-construct / unknown-command
error (never a silently wrong render) or hasn't been tested.
Supported
Structure & grouping: {...} grouping, nesting to arbitrary depth.
Fractions & binomials: \frac{a}{b}, \dfrac, \tfrac, \binom{n}{k}, \dbinom, \tbinom.
Roots: \sqrt{x}, \sqrt[n]{x}.
Scripts: x^a, x_a, x_a^b / x^b_a (either order), nested scripts with braces
(x^{a^b}). Prime marks are recognized as LaTeX shorthand for a superscripted \prime, not a
literal apostrophe: y', y'', y''' all work (y'_0 too — a prime combined with a
subscript), matching standard derivative notation.
Prescripts (isotopes): {}^{14}_{6}C (also written ^{14}_{6}C) renders as a real OMML
prescript object (m:sPre) — the mass number and atomic number positioned before the element
symbol, not an approximation. Either script alone also works ({}^{14}C).
Big operators: \sum, \prod, \coprod, \int, \iint, \iiint, \oint, each with
optional _{}/^{} limits. Sum/product-family operators place limits above/below
(display convention); integrals place them corner-style.
Limits & named functions (upright text): \lim, \limsup, \liminf, \max, \min,
\sup, \inf (stacked subscript when given a bare _{...}), \sin \cos \tan \cot \sec \csc,
\arcsin \arccos \arctan \arccot \arcsec \arccsc, \sinh \cosh \tanh \coth \sech \csch,
\log, \ln, \exp, \det, \gcd, \lcm, \dim, \ker, \deg, \arg, \hom, \Pr, \mod.
Delimiters: \left / \right with ( ) [ ] \{ \} | \| \langle \rangle \lfloor \rfloor \lceil \rceil and . (null delimiter on either side). Plain (non-\left\right) ( ) [ ]
are also supported as literal characters (not auto-sized). \middle divides the content into
multiple parts sharing one real OMML delimiter object (e.g. \left(A\middle|B\right),
\left\langle\psi\middle|\phi\right\rangle) — every \middle inside one \left...\right
group must use the same delimiter character (OMML has one separator character per group); a
mix throws a clear error rather than silently dropping a divider.
Dirac (bra-ket) notation: \bra{}, \ket{}, \braket{}{}, \ip{}{} (alias of
\braket), \ketbra{}{} (outer product), \expval{} — each builds a real OMML delimiter
object directly, the same structure \left\langle...\middle|...\right\rangle produces, not
separate \langle/|/\rangle symbols placed side by side (that plain-symbol form still
works too, e.g. \langle\psi|\hat{H}|\psi\rangle, just without the single-object semantics).
Matrices: matrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix environments,
any row/column count, cells separated by &, rows by \\. All columns are centered, which
is what these environments mean in LaTeX and what Word's own equation editor produces.
Arrays with column alignment: \begin{array}{lcr}...\end{array}, where each l/c/r
declares one column's alignment, rendered as OMML m:mcs column groups (adjacent columns
sharing an alignment are emitted as one group with a m:count, exactly as Word writes them).
array draws no delimiters of its own — wrap it in \left[...\right] for those.
Columns are l, c and r, plus single | rules between them — the augmented matrix
\left[ \begin{array}{cc|c} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array} \right]. OMML's matrix has no
column rules, so a ruled array is drawn the way Word users build one by hand: the columns
between rules as side-by-side matrices inside one delimiter object (m:d) whose separator is
|; a rule at either edge becomes that side's delimiter. Rows line up across the rule unless a
row is taller on one side than the other. It reads back from Word as the same array.
A Markdown-escaped rule, \| (as in {\|c\|c\|}, which chat assistants write), is the same |.
\hline (and booktabs' \toprule, \midrule, \bottomrule) at the start of a row of an
array or matrix draws a line above it; after the last \\ it draws the bottom line, so a fully
ruled table such as \begin{array}{|c|c|} \hline a & b \\ \hline c & d \\ \hline \end{array}
converts. OMML's matrix has no row lines either, so each is drawn as a row of lines, one per
column and as wide as that column. In the preview and MathML they are real row lines.
Double rules (||), \cline and fixed-width columns (p{3cm}) throw a clear error naming the
offending token rather than being silently dropped — Word matrices have no double lines, no
partial row lines and no fixed column widths.
Cases & simple systems: cases environment (\begin{cases}...\end{cases}), each row an
expression with an optional condition after &. Both columns are left-aligned, as in LaTeX.
equation/equation*: parsed as a single equation body.
Aligned equations: \begin{align}/\begin{align*} (rows may contain one & alignment
point), \begin{gather}/\begin{gather*} (no &, centered rows), and \begin{split} —
align's single-equation sibling, written inside equation — all rendered as OMML
m:eqArr. Important limitation, which applies to split exactly as it does to align:
OMML's eqArr has no native "align every row at a
shared column" behavior the way LaTeX's align does — each row renders its own content
correctly, but rows are not vertically aligned at the original & position across rows. See
docs/ARCHITECTURE.md. \begin{eqnarray} is not supported (it's deprecated in LaTeX itself
too) — use align.
Cancellation (cancel): \cancel{} (rising /), \bcancel{} (falling \) and
\xcancel{} (both), rendered as OMML m:borderBox with every border hidden and the
corresponding diagonal struck. The argument can be any expression, not just a character —
\cancel{\frac{a}{b}} strikes the whole fraction. \cancelto{v}{x} is not supported:
OMML can draw the strike but has no way to place a target value at the arrow tip, so it
throws rather than silently dropping the value.
Braces and stacked labels: \overbrace{} / \underbrace{} (OMML m:groupChr, a brace
that stretches to the width of what it spans) and \overset{label}{base} /
\underset{label}{base} / \stackrel{label}{base} (OMML m:limUpp/m:limLow). A brace
carrying a script — \overbrace{a+b}^{n} — puts the label centred over the brace, not at
superscript height beside it, which is what the notation means.
Paired delimiters (mathtools): \abs{}, \norm{}, \ceil{}, \floor{}. The
auto-size star (\abs*{}) is accepted and has no effect, because OMML's m:d always sizes
to its content — there is no second behaviour for the star to select. \DeclarePairedDelimiter
is not supported and is not a deferred feature: a math-mode expression has no preamble, so
there is nowhere for a user-defined macro to be declared.
\substack{a \\ b}: the stacked condition under a \sum, built as a one-column centred
array. It has a single column, so & inside it throws rather than being read as a second one.
Equation numbering: \tag{label} at the end of an equation numbers it (label) at the
right margin, the way Word numbers an equation itself: typing E=mc^2#(1) in Word's
equation editor stores the equation, a # and the number in one m:eqArr, and Word centres
the equation and puts the number at whatever right margin the page has. The task pane's
Number it does the same with a running number, a SEQ Equation field, and Renumber
keeps those in order (word/src/numbering.ts). \label/\ref/\eqref are handled by the
whole-document converter, and by the pane's Reference…, rather than by the equation
parser — see "Whole-document conversion" below — because a label has no visual form and a
reference has no meaning until there is a document for it to point into.
Font variants: \mathbb{} (\Bbb), \mathcal{} (\mathscr), \mathfrak{} — these
substitute the real Unicode Mathematical Alphanumeric Symbol codepoints (the same mechanism
Word's own Equation Tools "Double-Struck"/"Script"/"Fraktur" formatting uses), not a font
hack. \mathbf{} and \boldsymbol{}/\bm{} — bold upright and bold-preserving-italic
respectively, via OMML's m:sty.
Modular arithmetic: \pmod{n} (renders "(mod n)"), \bmod as an infix operator
(a \bmod b); bare \mod as a function name already worked in Phase 1.
Units: \si{...} and \unit{...} render their argument upright (not italic), the way
Word's own unit typesetting looks — and unlike \mathrm{}/\text{}, the argument is a real
nested parse, so \unit{m/s^2}'s exponent is a genuine superscript, not literal text.
Important: only plain unit text/expressions are supported (letters, digits, /, .,
^{}) — siunitx's per-unit macro vocabulary (\kg, \meter, \per, \square, prefix
macros, etc.) is not implemented and throws a plain unknown-command error naming the macro.
Write \unit{kg.m.s^{-2}}, not \unit{\kg\per\second}.
Accents: \vec, \hat/\widehat, \bar/\overline, \dot, \ddot, \tilde/\widetilde,
\check, \breve, \overrightarrow, \overleftarrow, \overleftrightarrow (the line AB),
\underline (an OMML bottom bar).
School notation (added October 2026):
- Logic and relations:
\implies⟹,\impliedby⟸,\iff⟺,\leqslant⩽,\geqslant⩾, the negated relations\nleq \ngeq \nless \ngtr \nsubseteq \nsupseteq \subsetneq \supsetneq \ncong \nsim \nparallel \nmid \nequiv,\triangleq,\approxeq,\backsim,\vdash,\models; and\notbefore a relation with a crossed-out form (\not=,\not\in,\not\subset,\not\equiv,\not\to, ...). - Geometry:
\triangle,\square,\blacksquare,\diamond,\measuredangle,\sphericalangle,\frown,\smile; the arc AB as\overarc{AB}/\overparen{AB}(and\underparen), an OMML group character⏜that reads back as\overparen. - Floors and ceilings on their own:
\lfloor x \rfloor,\lceil x \rceil(as well as inside\left...\right). - Arrows:
\Longrightarrow \Longleftarrow \Longleftrightarrow \longleftrightarrow \longmapsto \hookrightarrow \hookleftarrow \twoheadrightarrow \leadsto \rightsquigarrow \rightleftarrows \leftrightarrows \leftrightharpoons \leftharpoonup \rightharpoondown \Uparrow \Downarrow \updownarrow \Updownarrow, and the labelled\xleftrightarrow \xRightarrow \xLeftarrow \xLeftrightarrow \xrightleftharpoons \xleftrightharpoons \xmapsto \xhookrightarrow \xhookleftarrow(each[below]{above}, like\xrightarrow).\leftharpoondownnow draws ↽; it used to draw ⇁, which is\rightharpoondown. - Big operators:
\bigcup \bigcap \bigoplus \bigotimes \bigodot \biguplus \bigvee \bigwedge \bigsqcup(limits stacked, like\sum), and\iiiint \oiint \oiiint.\limitsand\nolimitsstraight after an operator move its limits (\int\limits_0^1,\sum\nolimits_i), and after a function name (\det\limits_A,\lim\nolimits_x). Reading back from Word writes them only where the limits sit against the operator's habit. - Boxes and colour:
\boxed{x = 3}(an OMML border box with all four sides drawn);\textcolor{red}{x},\color{red}(which colours the rest of its group, as in LaTeX), and\textcolor[HTML]{1F77B4}{x}. Names are xcolor's base set (red green blue cyan magenta yellow black white gray darkgray lightgray brown lime olive orange pink purple teal violet) with xcolor's own values; in Word the colour is the run colour of the text, so a fraction bar or radical sign keeps the document's colour. - Fonts:
\mathsf(sans-serif) and\mathtt(monospace), as Unicode mathematical alphanumerics like\mathbb;\mathit(italic, including digits). - Fractions:
\cfrac(a continued fraction is an ordinary fraction in Word). - Style switches:
\displaystyle,\textstyle,\scriptstyle,\scriptscriptstyleare accepted and change nothing: Word sizes an equation by whether it is inline or display (the Display checkbox). - Systems:
alignedandgatheredinside an equation —\left\{ \begin{aligned} x + y &= 3 \\ x - y &= 1 \end{aligned} \right.— and an equation array inside a delimiter reads back from Word asaligned/gathered, which real LaTeX can nest (align*cannot be). - The physics package:
\dv{y}{x},\dv[n]{y}{x},\dv{x}(an upright d),\pdv{f}{x},\pdv[n]{f}{x},\pdv{f}{x}{y}(mixed, second order),\dd{x},\vb{F}(upright bold),\vb*{F}(bold italic),\va{a},\grad,\curl,\divergence,\laplacian,\ev{A},\mel{a}{H}{b}. Each is written out as the structure it draws, so it reads back from Word as that structure (\dv{y}{x}comes back as\frac{\mathrm{d}y}{\mathrm{d}x}). The physics package's\div(divergence) is not supported:\divis ÷, as in core LaTeX. - Units:
\AA(Å),\mho(℧). \epsilonis now ϵ and\varepsilonε, as in LaTeX; both used to draw ε.
Text: \text{...}, \mathrm{...}, \textrm{...}, \textnormal{...}, \textup{...},
\operatorname{...} (spacing inside is preserved), and styled text \textbf{...},
\textit{...}, \textsf{...}, \texttt{...}. Hyphenated words (\text{Sub-questions}) go
into Word as a normal-text run, so the hyphen stays a hyphen rather than a spaced minus.
Spacing: \, \; \: \! \quad \qquad \ (escaped space).
Greek letters: all lowercase (\alpha...\omega including \varepsilon \vartheta \varpi \varrho \varsigma \varphi) and the upper-case letters that are visually distinct from Latin
(\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega).
Operators & relations: \pm \mp \times \div \cdot \ast \star \circ \bullet \oplus \ominus \otimes \oslash \odot \setminus \wedge \vee \cup \cap, \leq \geq \neq \approx \equiv \sim \simeq \cong \propto \parallel \perp \in \notin \ni \subset \subseteq \supset \supseteq \sqsubseteq \sqsupseteq \prec \succ \ll \gg \asymp \doteq.
Arrows: \rightarrow \to \leftarrow \gets \leftrightarrow \Rightarrow \Leftarrow \Leftrightarrow \mapsto \longrightarrow \longleftarrow \rightleftharpoons \rightharpoonup \leftharpoondown \uparrow \downarrow \nearrow \searrow \swarrow \nwarrow.
Misc symbols: \infty \partial \nabla \forall \exists \nexists \emptyset \varnothing \ldots \cdots \vdots \ddots \therefore \because \angle \top \bot \aleph \hbar \hslash \ell \Re \Im \wp \prime \surd \degree \imath \jmath \langle \rangle \lVert \rVert \Vert \vert \mid \neg \lnot \checkmark \dagger \ddagger \Box. Escaped literal characters: \% \$ \# \& \_ \{ \} \, and escaped space.
Physics (built from the above general math machinery, plus the Phase 3 additions below):
Greek letters, \hbar, \nabla\cdot, \nabla\times, vector/hat/bar/dot accents
(\vec{F}=m\vec{a}, \hat{H}\psi=E\psi), \dagger (Hermitian conjugate, \hat{a}^\dagger),
\Box (d'Alembertian). Dedicated bra/ket notation (\bra, \ket, \braket, \ketbra,
\expval, and \middle-divided \left...\right) — see above — plus the older plain
\langle ... \rangle and | symbol style, which still works. Tensor-style indices via
ordinary sub/superscripts (g_{\mu\nu}, p^\mu, \eta^{\mu\nu}) for indices stacked directly
above/below the base; indices staggered after the base (T_i{}^j) render via an
empty-base-superscript/subscript immediately following — the best available approximation,
since OMML has no dedicated "postscript" object (see docs/ARCHITECTURE.md "Phase 3
additions"). Unit typesetting via \si{}/\unit{} (see above).
Chemistry, plain math mode (built from the above general machinery, no chemistry-specific
parsing): molecular formulas via subscripts (H_2O, C_6H_{12}O_6), ionic charges via
superscripts (Na^+, SO_4^{2-}), plain reaction arrows (\rightarrow, \rightleftharpoons,
\leftrightarrow), and isotope notation via the prescript support above ({}^{14}_{6}C,
{}^{235}_{92}U). Important: bare element symbols typed directly this way (e.g. Na)
render as individually-italicized letters, matching standard LaTeX math-mode behavior — not
upright chemistry-style text. Use \mathrm{Na}^+/\text{Na}^+ for upright element symbols
here, or use \ce{} below, which handles this automatically.
Labeled reaction/limit arrows: \xrightarrow{above} and \xleftarrow{above}, each with an
optional [below] (e.g. A \xrightarrow[\text{cat.}]{\Delta} B) — a real OMML object
(m:limUpp/m:limLow around the arrow glyph), not an approximation. {above} is a required
argument in real LaTeX; an empty group (\xrightarrow{}) is treated as "no label," not an
empty box. Only \xrightarrow/\xleftarrow are supported — there is no \xrightleftharpoons
or other x-prefixed variant.
Chemistry, \ce{...} (mhchem-style shorthand): a deliberately scoped subset of the real
mhchem package, implemented as its own mini-grammar (not a bolt-on to plain math parsing) —
see domain/src/chemistry.ts for the exact rules. What it adds over writing the same formula
in plain math mode: real upright element-symbol styling automatically (no manual \mathrm{}),
and shorthand that skips explicit _/^:
- Element symbols (
[A-Z][a-z]*, e.g.Na,Cl,Fe) render upright automatically.\ce{H2O},\ce{NaCl},\ce{Al2(SO4)3}. - A number immediately after an element or a
(...)/[...]group (no space) auto-subscripts it:\ce{H2O}→ H₂O. A number with a space before it is a separate, unsubscripted stoichiometric coefficient:\ce{2 H2O}. - A trailing
+/-run, written with no space before it, auto-superscripts as an ionic charge:\ce{Na+},\ce{Fe2+},\ce{SO4^2-}(the last with an explicit^, also supported — with or without braces,\ce{SO4^{2-}}and\ce{SO4^2-}both combine the digit and sign into one charge). The identical+/-with a space is a plain operator, not a charge:\ce{H2 + O2}— this spacing-sensitivity matches real mhchem. (...)and[...]are literal grouping delimiters; a following number/charge attaches to the whole group:\ce{Ca(OH)2},\ce{[Cu(NH3)4]^2+}.->,<-,<=>become reaction/equilibrium arrows (→/←/⇌). A[condition]immediately after one (no space) becomes a label above the arrow, using the same\xrightarrow{}machinery above:\ce{A ->[cat.] B},\ce{CaCO3 ->[\Delta] CaO + CO2}. A second bracket goes under the arrow:\ce{CH2=CH2 + H2 ->[Ni][\Delta] CH3-CH3}. Spaces inside a condition are kept:\ce{->[conc. H2SO4][443 K]}.- Organic bonds: a
-with an atom straight after it is a single bond, not a charge —\ce{CH3-CH2-OH},\ce{R-COOH};=is a double bond (\ce{CH2=CH2}) and#a triple bond (\ce{HC#CH}→ HC≡CH). A-that ends a formula is still a charge:\ce{Cl-}. - Named single-glyph commands already in the shared symbol table work too, e.g.
\Delta, Greek letters — but not compound commands like\frac/\sqrt(throwsunknown-command). - Isotopes and nuclear equations:
^{mass}_{atomic number}before an element —\ce{^{14}_{6}C},\ce{^{235}_{92}U + ^{1}_{0}n -> ...},\ce{^{0}_{-1}e}— as a real OMML prescript (m:sPre). Either number may be left out; the numbers must be followed by an element. - Asymmetric equilibrium arrows (
<<=>,<=>>, favoring one direction) are not supported — no distinct OMML glyph exists for the different-weight harpoons real mhchem draws; use the plain<=>instead. Throwsunsupported-construct, never a misleading plain arrow.
Oxidation states and precipitate/gas notation: no dedicated formatting — oxidation states
reuse plain parenthetical text (\ce{Fe(III)}) or superscripts, and precipitate/gas markers
reuse the general \uparrow/\downarrow symbols as suffix annotations (\ce{AgCl \downarrow})
rather than mhchem's special bare v/^ shortcut characters, which are not implemented.
Probability, statistics, sequences, differential equations (also built from the above,
no dedicated grammar needed): P(A), P(A \mid B), E[X], \text{Var}(X), \hat{p},
\bar{X} all work via existing delimiter/accent/text machinery; y', y'', y^{(n)},
\frac{\partial^2 u}{\partial x^2} work via prime shorthand and existing fraction/script
machinery; \binom{n}{k} covers permutations/combinations notation.
Converting Word equations back to LaTeX (brief §1.10)
"Equation to LaTeX" (and "Load equation into the editor") reads the LaTeX source of the equation under the cursor. For an equation TeXConverter itself inserted with its round-trip metadata intact, this is your exact original source. Otherwise — a native Word equation built by hand, or a TeXConverter equation whose metadata is missing (the "Store source metadata" setting was off, or the source was too long to store) — it's reconstructed from the equation's OMML structure instead, and the task pane shows a small notice saying so.
The correctness bar for reconstruction: the reconstructed LaTeX, when converted back to
OMML, always reproduces the same equation — not necessarily the same LaTeX syntax you'd get
from typing it yourself. For example, an equation built from mhchem's \ce{H2O} shorthand
reconstructs as plain subscript LaTeX (something like \mathrm{H}_{2}\mathrm{O}), not
\ce{H2O} — OMML has no memory of \ce{} syntax once it's been rendered, only the resulting
structure. This is a deliberate design choice, not a bug: every one of the 400+ expressions in
this repo's test corpus round-trips through reconstruction to a semantically identical result
(same rendered structure), verified in tests/unit/reverse-roundtrip.test.ts.
Reading OMML as Word writes it. Word does not hand back the markup it was given: it
re-serialises, dropping every property whose value equals the format's default, merging and
splitting runs, and adding elements of its own. Reconstruction therefore takes the documented
default wherever a property is absent — an m:nary with no m:chr is a summation, an
m:rad with no m:degHide shows its degree, an m:acc with no m:chr is a hat — because
that is what Word's own renderer draws, and so what is on the user's screen. It also reads
m:func (Word's "apply a function" object) and sees through m:box (a layout wrapper with
no visible content of its own).
Reconstruction is aimed at LaTeX a person would recognise, not just LaTeX that re-renders:
an upright run whose text is a function name comes back as \sin, \log, \tan rather
than \mathrm{sin}, and the operators Word merged into the same run come out bare instead
of being swept into the wrapper with it. y = \tan x + c rather than y\mathrm{=tan}x+c.
Both forms render to identical OMML.
An n-ary operator with content after it — \int dy = \int \sec^{2}x\,dx, the shape of
most integral equations — is braced on the way out ({\int dy}=\int \sec^{2}xdx). LaTeX
gives such an operator "everything remaining in the group" as its operand, so without the
braces the first integral would swallow the rest of the line when read back. The braces are
emitted only where an operator actually has something after it.
What reconstruction cannot do, and throws a clear error for instead of guessing:
- A labeled arrow (the OMML shape shared by
\xrightarrow/\xleftarrowand\ce{}'s reaction-condition arrows) using any glyph other than the plain long arrows (⟶/⟵) those two LaTeX macros themselves produce — e.g. the short "→"\ce{A ->[cat.] B}renders internally. There's no direct LaTeX macro for that combination outside mhchem's own arrow shorthand, which (as above) leaves no trace in the OMML to reconstruct from. - A bottom-positioned bar accent (
m:barwithpos="bot") — LaTeX has\bar/\overlinefor a top bar, but no standard bottom-bar macro to reconstruct into. - A run whose styling doesn't match plain text,
\mathbf,\boldsymbol,\mathrm,\mathbb,\mathcal, or\mathfrak— this would only happen with a hand-crafted or foreign equation using OMML styling TeXConverter's own renderer never produces.
In every one of these cases you'll see a specific, human-readable error rather than a wrong or partial LaTeX reconstruction — consistent with the rest of this add-in's "never guess" policy (brief §17).
Explicitly not supported yet (throws a clear error, never mis-renders)
\begin{eqnarray}— deprecated in LaTeX itself; use\begin{align}(supported).- Asymmetric equilibrium arrows inside
\ce{}(<<=>,<=>>) — see "Chemistry,\ce{...}" above. Plain<=>(⇌) works. - Compound math commands (
\frac,\sqrt, ...) inside\ce{}— see "Chemistry,\ce{...}" above for the exact scope and workarounds. \notbefore a symbol with no crossed-out form (\not\alpha) — Word cannot strike through an arbitrary glyph.\not=,\not\in,\not\subset,\not\equivand the other relations with a negated character work.\cfrac[l]/\cfrac[r]— the numerator alignment has no OMML property; plain\cfracworks.- Colour models other than names and
[HTML](\textcolor[rgb]{...}), and colour names outside xcolor's base set. \slashed{p}(Feynman slash notation) — deliberately not implemented, but not for the reason previously given here. This used to say no OMML mechanism draws a diagonal strike through a base. That is false:m:borderBoxwithm:strikeBLTRdoes exactly that, and\cancelnow uses it. The real reason is that the two would be indistinguishable. A Feynman slash and a cancellation are different notations that would produce identical OMML, so every\slashed{p}in a document would come back from Word as\cancel{p}— silently turning a Dirac operator into an arithmetic cancellation. Write\gamma^\mu p_\muinstead.- siunitx per-unit macros (
\kg,\meter,\per,\square, prefix macros, ...) inside\si{}/\unit{}— only plain unit text/expressions are supported; see "Units" above. \middlewith a different delimiter character than an earlier\middlein the same\left...\rightgroup — OMML's delimiter object has one separator character shared by the whole group, so mixed\middlecharacters can't be represented; use the same character throughout (typically\middle|).- Cross-references (
\label,\ref,\eqref) inside a single converted equation —\tag{}for one equation's label works (see above). Across a whole document they are supported, and become live Word fields: see "Whole-document conversion" below. - Interval notation shorthands and explicit set-builder templates beyond plain symbol
composition (the underlying symbols —
\in,\mid, brackets — all work; there's no dedicated\interval{}-style helper). - Stereochemistry wedge/dash bonds, mhchem's special bare
v/^precipitate-gas shortcut characters, and dedicated oxidation-state formatting (beyond plain parenthetical text / superscripts) —\ce{...}itself is now implemented; see "Chemistry,\ce{...}" above for its scope, and "Oxidation states and precipitate/gas notation" above for what's reused instead of dedicated formatting. - Any command not listed above (e.g.
\newcommand, package-specific macros) — reported asunknown-commandwith the offending command name. (\chemfigis not an equation command: structures are drawn as figures — see Figures below.)
Whole-document conversion
Everything above concerns a single equation. Converting a whole file — .docx ⇄ .tex,
via node build/texconverter.mjs convert <file> — adds a second, separate vocabulary: the
commands a manuscript is built from rather than the ones an equation is built from. Maths
inside such a file is handed to the same parser, so the list above applies unchanged.
This is a document parser, not a LaTeX compiler. It does not expand \newcommand, run
packages, or evaluate conditionals. That is deliberate: half-implementing TeX would produce
documents that are wrong in ways nobody can predict, where declining a construct produces a
line in the report.
Supported in a .tex:
| Construct | Becomes, in Word |
|---|---|
\documentclass, preamble |
Read for options, then dropped — Word has its own styles |
\part, \chapter, \section … \subparagraph |
Heading 1–5 |
\begin{itemize} / \begin{enumerate}, nested |
Bulleted and numbered lists |
\begin{tabular}, \hline, &, \\ |
A table with borders |
\textbf, \textit, \emph, \texttt, \underline |
Run formatting |
$…$, $$…$$, \(…\), \[…\], equation, align, gather |
Word equations; the unstarred environments numbered (1), (2)… at the right margin as a live SEQ field, one number per align block |
\label, \ref, \eqref, \pageref |
A bookmark round the equation's number and a live REF field showing it |
\cite{a,b} + \bibliography |
A numbered label and a reference list |
\includegraphics[width=…] |
An embedded image |
\footnote |
A real Word footnote |
\href, \url |
A hyperlink |
\input, \include |
Spliced in, resolved relative to the .tex |
\begin{verbatim}, \begin{lstlisting} |
One paragraph per line, taken literally (not monospaced) |
\begin{center}, \begin{flushright} |
Paragraph alignment |
% comments, ~, \\, --, ---, \% and the other escapes |
Handled |
\begin{tikzpicture}, \begin{axis} |
A drawn figure — see Figures below |
\chemfig, \chemname, \schemestart … \schemestop |
A drawn structure or reaction — see Figures below |
Not supported, and reported rather than guessed at: \newcommand and macro expansion,
\usepackage-specific syntax, figure/table float placement (the contents convert; the
float is not modelled), \begin{minipage}, inline \verb, \bibliographystyle beyond
plain/unsrt/ieee, and per-column alignment in tabular (a column is written as
left-aligned whatever r or c said).
Label names are rewritten, and stay rewritten. A \label becomes a Word bookmark, and
Word's bookmark names may only contain letters, digits and underscores, must start with a
letter, and may not exceed 40 characters. \label{eq:main} therefore becomes the bookmark
eq_main, and converting back out gives \label{eq_main} — the reference still resolves,
and it resolves to the same equation, but the name is not the one that was written. This is
a limit of the .docx format, not a choice.
A .tex is treated as untrusted input. \input{../../etc/passwd} is a valid command;
resolution is confined to the folder the .tex lives in, the same rule a LaTeX
distribution applies with openin_any.
Converting back out (.docx → .tex) covers the same ground, plus one thing a .tex
never needs: LaTeX that was typed as text into the Word document, which is how a great
many question banks and lecture notes are actually written. $x^2$ sitting in a paragraph
as prose is promoted back to a real equation — see "Delimiter auto-detection in document
text" below, which governs it, and --dollar on the command line.
Figures
A tikzpicture is drawn on the device by a TypeScript interpreter written for this project,
and becomes an SVG in the document. No TeX runs, nothing is compiled, and nothing is sent
anywhere — the same guarantee the equation converter makes, and the reason a TeX-to-SVG
service was rejected rather than adopted.
The consequence is that this is a defined subset, not TikZ. Anything outside it throws a named error saying which command or option it choked on, and the figure's source is kept in the document as text rather than a wrong picture being drawn. One refused figure never fails a document.
pgfplots
| Construct | Notes |
|---|---|
\begin{axis}[…] |
xmin/xmax/ymin/ymax are required — see below |
xlabel, ylabel, title |
May contain $…$; see the label limits below |
grid=none|major|both, xtick={…}, ytick={…} |
\empty gives no ticks |
\addplot[…] {expression} |
domain=a:b, samples=n (2–5000) |
\addplot[…] coordinates {(x,y) …} |
With only marks for a scatter plot |
\addplot […] {…} \closedcycle |
Closes down to the axis: the area under a curve |
\addplot[…] ({x(t)}, {y(t)}) |
A parametric curve; the parameter is x, or variable=\t names another |
axis lines=box|left|middle|center|none |
middle crosses the axes at the origin, with arrowheads |
unbounded coords=jump, restrict x to domain=a:b, restrict y to domain=a:b |
Breaks the curve where it has no value, so tan doesn't draw up its asymptotes |
only marks, mark=*, mark size= |
|
scale only axis, width=, height= |
Accepted; the figure is drawn at a fixed size for a Word column |
\draw, \fill, \node inside an axis |
Placed in the axis's coordinates, (axis cs:x,y) or (x,y) |
fill=, draw=, color=, opacity=, fill opacity= |
xcolor names, blue!20, blue!20!black, #rrggbb |
thick, very thick, thin, dashed, dotted, line width= |
Everything inside an axis is clipped to the plot box, as pgfplots clips it: a curve stops at the frame, and a mark or label anchored outside it is left out.
Plain TikZ
Enough for school geometry and physics figures: blocks on inclines, pulleys, springs, discs and rings, lenses and rays, pendulums, energy levels. The Diagrams picker's Physics section has a starting point for each.
| Construct | Notes |
|---|---|
\draw, \fill, \filldraw, \path |
--, -- cycle, |- and -|, +(…) and ++(…) relative points |
(c) circle (r), circle[radius=r], (c) ellipse (a and b) |
Round the current point; plain numbers are cm, 2pt and 3mm work |
arc (start:end:r), arc[start angle=…, end angle=…, radius=…] |
From the current point, as TikZ draws it |
(a) rectangle (b), (a) grid (b) with step= |
Both turn with the scope |
.. controls (a) and (b) .. (c), to[out=…, in=…], to[bend left=…] |
Curves |
plot[smooth] coordinates {…}, plot[domain=a:b, samples=n] (\x, {f(\x)}) |
smooth cycle closes it |
\node[…] (name) at (x,y) {text}, node[…] {text} on a path |
midway, pos=, near end, sloped; above=4pt, anchor=north; draw, fill, circle, ellipse, rounded corners, minimum size/width/height, inner sep, font=\small, label=above:$A$; \\ breaks the text into lines |
\coordinate (A) at (…), (A), (A.north), (A.30), $(A)!0.5!(B)$, $(A)+(1,0)$ |
A line drawn to a named node stops at its edge |
\foreach \x in {0,...,5}, \foreach \x/\y in {…}, [count=\i] |
At most 2000 runs in a picture |
\begin{scope}[shift=…, rotate=…, scale=…, thick] |
The same transforms on the picture or on one \draw; xshift, yshift, xscale, yscale |
name/.style={…}, every node/.style={…}, \tikzset{…}, help lines |
Styles |
Arrow tips ->, <->, -latex, -stealth, -{Stealth[…]}, |<->|, -* |
A line stops under its arrowhead |
pattern=north east lines (and north west lines, horizontal lines, vertical lines, crosshatch, dots) |
Hatched ground and walls; pattern color= |
decorate, decoration={coil|zigzag|snake|brace|border, …} |
Springs, waves, braces for a length, ticks along a wall; amplitude, segment length, aspect, mirror, raise, pre length, post length |
postaction={decorate}, decoration={markings, mark=at position 0.5 with {\arrow{>}}} |
An arrow in the middle of a ray or a current |
rounded corners, shorten >=…, shorten <=… |
Circuits (circuitikz)
\begin{circuitikz} … \end{circuitikz} (or a tikzpicture) with components on wires written
as circuitikz writes them: \draw (0,0) to[battery1, l=$E$] (0,3) to[R=$R$] (4,3) to[ammeter] (4,0) -- cycle;.
Each symbol sits in the middle of its wire and turns with it; the shapes are the ones school
books use (a zigzag resistor, a cell as a long and a short plate, a meter as a circle with its
letter), and [european resistors] on the picture gives box resistors.
| Construct | Notes |
|---|---|
R, vR (rheostat), pR (potentiometer), C, L |
Also resistor, capacitor, inductor |
battery1 (a cell), battery (several), V, sV (AC), I |
|
switch (open key), ncs (closed), lamp, fuse, short, open |
|
ammeter, voltmeter, galvanometer, ohmmeter |
|
D, D*, led, zD |
|
R=$R_1$ or l=…, l_=…, a=…, v=…, i=$I$ (i<= reverses it), mirror, invert |
Labels and a current arrow |
*-*, o-o, -*, … |
Junction dots and terminals at the wire's ends |
node[circ] {}, node[ocirc] {}, node[ground] {} |
When a circuit is written out as LaTeX, \usepackage{circuitikz} goes in the preamble.
Expressions are evaluated by a small recursive-descent evaluator with no eval anywhere
near it — a .tex file is untrusted input. It has + - * / ^, unary minus, pi and e, the
variables x, y, z, and about twenty-five functions. Trigonometry is in degrees, as
pgfmath's is: sin(x) over domain=0:6.28 is a nearly flat line, and sin(deg(x)) is how
you ask for a sine wave. An unknown name is an error, never a silent NaN.
Deliberately refused, with the reason:
- Axis limits are not inferred from the data. pgfplots infers them; this does not, because
inferring them means the same source draws a different picture depending on how many samples
were taken. Write
xmin/xmax/ymin/ymax. - A label is one line of text.
xlabel={$x^2$}works — the$…$goes through the same equation parser as everything else, and comes out as runs with superscripts and subscripts. A fraction or a radical in a label needs real two-dimensional typesetting and is refused by name rather than losing its numerator. \addplot table {file}and any other read from disk. There is no filesystem here.ymode=log,shader=,surf,mesh,colormap,\shade,\clip,pic, the positioning library (above=of A), and circuit symbols beyond those below (transistors, op amps, logic gates). Each throws naming itself. Aymode=logplot drawn linearly looks entirely plausible and is a different figure.- tkz-euclide —
\tkzDefPointand its family are recognised and refused by name. The constructions are the next phase of this work. - An axis and free drawing side by side in one picture. A
\drawor\nodeinside the axis is placed in its coordinates; one beside it has no frame to be placed in, and either choice would put it somewhere plausible and wrong. - A named or polar point inside an axis (
(A),(30:2)). pgfplots places those in centimetres, not in the axis's data, and a figure that mixes the two is rarely what was meant.
Chemical structures and reactions (chemfig)
A \chemfig{…} structure, a \chemname{…}{name}, or a reaction written
\schemestart … \schemestop is drawn by the same subsystem, in chemfig's own geometry: the
rules were taken from chemfig's source rather than approximated, so a ring, a bond angle or a
branch lands where LaTeX would put it. In a .tex file a \chemfig sits in the line of text,
and a scheme becomes its own centred paragraph; both go back out as the source they were, with
\usepackage{chemfig} added to the preamble.
| Construct | Notes |
|---|---|
Atoms: H_3C, NO_2, NH_4^+, {(CH_3)_2} |
A group splits into atoms at each capital, as chemfig splits it; braces keep one together |
Bonds - = ~ |
Single, double, triple; =^ and =_ put the second line on one side |
Wedges > <, >: <:, >| <| |
Filled, hashed and hollow, either way round |
Bond options [angle,length,from,to,style] |
[2] is 2 × 45°, [:30] absolute, [::30] relative; length a multiple of 3em; atom numbers from 1; style takes a colour, a width, dashed, or draw=none |
Branches (…) |
Any depth; off a ring corner a branch points straight out of the ring |
Rings *n(…) and **n(…) |
3 to 12 sides; ** adds the aromatic circle; a ring inside a ring is fused along an edge; fewer bonds than sides leaves the rest open |
\chemfig{[:30]…} |
A leading angle turns the molecule |
\schemestart … \schemestop |
Compounds joined by \+ and \arrow; \+ sets them side by side |
\arrow{->[above][below]}[angle,length] |
->, <-, <->, <=> (equilibrium); a label is text, $…$ maths, \ce{…} or a \chemfig; any angle, with the next compound centred on the arrow's line; "above" is the arrow's left |
\arrow(a--b), \arrow(@a--c) |
a names the compound the arrow leaves, b the one it arrives at; @a leaves a named compound again, so a scheme branches |
\lewis{0:2.4|6I,O}, \Lewis |
Electrons round an atom at multiples of 45°: : a pair, . one electron, | a pair as a line, I an empty orbital; set just outside the letter, across their direction |
\charge{90=$\oplus$,0=\:}{N}, \Charge |
A charge or electrons at an angle in degrees or a compass point (north east); wraps a \lewis atom too; two things at one place stack outwards. :2pt shifts are read and set at the usual distance |
A?-B-C-D?, ?[name,bond,tikz] |
A hook: each later atom with the same hook is bonded to the first, which closes a ring drawn bond by bond (a Haworth sugar). The bond is -, =, ~, >, <, >:, <:, >| or <|, with bond options such as line width=2pt after it. A hook never matched is refused |
\chemname{compound}{name} |
Names are set on one line under the lowest compound in each row; an arrow down from a named compound starts below the name |
Refused by name: options on \lewis and \charge, submolecules (!),
named atoms and bonds (@{…}), bond offsets (#(…)), options on \chemfig itself,
anchors on an arrow's ends (a.east), an arrow back to a compound already drawn (--@a),
\subscheme, \chemleft/\chemright and \chemmove.
A figure survives the round trip as source, not as a picture. The tikzpicture that was
drawn is stored on the picture's Title field in the .docx (wp:docPr/@title; @descr stays
real alt text), so .tex → .docx → .tex gives back the figure you wrote, editable, rather than
\includegraphics{figure1.svg}. A source longer than 8000 characters is reported and the
picture written without it — never truncated, because half a tikzpicture reads back as a
figure and fails to draw.
In the Word pane, the Diagrams panel draws the same subset and inserts the figure as a
PNG picture, drawn at twice its size so it stays sharp in print, with the source on its Title
in the same form. So Edit selected loads it back, and Save as .tex writes it out as the
tikzpicture it was.
In a converted .docx file (Open a .tex, the desktop app, the command line), a figure is
written as an SVG. Word needs a raster fallback plus an asvg:svgBlip extension before it will
display one, and these converters don't yet write it; the conversion says so in its report. The
package itself is valid and every other tool reads it.
LaTeX on the way out
The reverse direction ("Equation → LaTeX") writes LaTeX back into the document as text,
and the delimiters it uses are chosen in the pane's LaTeX format picker
(renderers/src/latex-format.ts):
| Format | Inline | Display |
|---|---|---|
| TeX (default) | $...$ |
$$...$$ |
| LaTeX | \(...\) |
\[...\] |
| LaTeX equation environment | \(...\) |
\begin{equation}...\end{equation} |
| No delimiters | bare source | bare source |
Every delimited format is the exact inverse of the stripping described below, so anything
written out can be converted straight back into the same equation; "no delimiters" is not,
and is offered for pasting into somewhere that supplies its own. There is no inline equation
environment in LaTeX, so that format falls back to \(...\) for inline maths rather than
promoting it to a numbered display equation.
The maths itself is whatever renderers/src/ir-to-latex.ts reconstructs, which always braces
its scripts — \frac{d^{2}y}{dx^{2}}+xy=0, not \frac{d^2y}{dx^2}+xy=0. Both parse
identically; the braced form is emitted because it is unambiguous under every LaTeX dialect
that might read the document next.
Delimiter auto-detection in document text
LaTeX → Equation · Selection strips $...$, \(...\), \[...\], $$...$$, and
\begin{equation}...\end{equation} from the selected text before conversion
(word/src/delimiters.ts).
LaTeX → Equation · Document scans arbitrary document text for the same delimiters, plus
\begin{equation*}, \begin{align}, \begin{align*}, \begin{gather}, and
\begin{gather*} (word/src/scan.ts). For \begin{align}/\begin{gather} (and their
starred forms), the environment wrapper is kept as part of the converted text rather than
stripped — the wrapper itself is what tells the parser to build a multi-line eqArr, so
a &= b \\ c &= d alone (without \begin{align}...\end{align} around it) isn't valid
input. $$...$$, \[...\], and \(...\) are stripped to their inner content, same as
the selection pass.
Recognized spans are converted with the same pipeline as everything else in this document
(convertLatexToOmml), so anything listed as supported above works inside a scanned
document exactly as it does when typed directly into the TeXConverter input box.
The $...$ currency problem (brief §13)
A bare $...$ pair is genuinely ambiguous with a price — $5, $19.99 and $5.00 are not
math. By default ("smart" mode) TeXConverter rejects a $...$ pair if the character right
after the opening $ is whitespace, or the character right before the closing $ is
whitespace, since real LaTeX essentially never writes math that way, while currency always
does. A pair that opens with a digit is maths only when it is plainly maths: a number closed
at once ($186$, as answer options are written), a letter or command straight after a digit
($3x + 4y = 0$, $2\frac{1}{2}$), or one of = ^ _ \ { }. Otherwise ($5-$10) it is a
price. This is a heuristic, not a guarantee:
- False negative (safe failure): maths that opens with a digit and has none of those
marks (
$2 + 3$) is still read as a price by the document-wide pass. Selecting it and using the Selection pass converts it: an explicit selection reads a bare$...$as maths unconditionally, because selecting it is the user resolving the ambiguity by hand. - Two other modes are available, in Settings under "Convert Document"
(
Settings.singleDollarMode):"always"treats every well-formed$...$pair as math (for math-only documents with no currency at all), and"never"skips single-$scanning entirely (safest for finance-heavy documents;$$,\[\],\(\), and the environment forms are unaffected either way).
An escaped \$ is never treated as a delimiter, in any mode.
A known Word API limitation that affects Convert Document specifically
Word's Range.search() — which Convert Document uses to relocate each detected span so it
can be replaced — has a documented limit on how long its search text can be (around 255
characters). An expression longer than that is reported under "needs attention" with a
message pointing you at Convert Selection, which has no such limit (it works on your actual
selection, not a search). This is very unlikely to affect a typical inline or single-line
display equation; it's realistically only reachable with an unusually large matrix or a very
long align block.