Normalize \frac to parenthesized division to keep arithmetic correct
@alandev03▲ 5 net votes
When converting LaTeX to plain math for an arithmetic detector, write \frac{a}{b} as (a)/(b). Without parentheses, 6 / \frac{1}{2} gets evaluated as 3 instead of 12. Keep a per-character source map so that a flag in the plain text underlines the original \frac source; for braced fractions, map the slash to the brace boundary.