Repository navigation
v0.10.0
This release replaces the serializer's seven option axes with two output styles: spaced, the previous default, and a new compact style for human-readable LaTeX. With physics, named functions such as \sin and \exp now parse the argument that physics.sty prints as an auto-sized fence, and three Faithful rules make that fence explicit. Normalization also no longer removes a group or a delimiter size that kept a preceding command from reading the next token as an argument on reparse. The serializer change is breaking; see Changed for migration notes.
Changed
- Breaking:
SerializeOptionsnow holds a singlestyle: Style, eitherStyle::Spaced(default) orStyle::Compact.CommandSpacing,MathGroupInnerSpacing,AdjacentCharSpacing,ScriptSpacing,ScriptOrder,InfixGrouping, andEnvironmentNameSpacingare removed, and Pythonto_latexand JavaScripttoLatexaccept only thestylekey and reject the removed ones. Spaced output is byte-for-byte identical to the previous default and stays byte-stable across releases. Replace axis settings withSerializeOptions { style: Style::Compact },to_latex(style="compact"), ortoLatex({ style: "compact" }); combinations that compacted only some axes,sup_firstscript order, and always-explicit infix operands have no replacement. - With
physics, the 26\trigbracesnames (\sin…\coth,\asin…\acot,\log,\ln) takeo d(), and\exp,\det,\Pr,\tr, and\Trtake one pairedd<(,)><[,]><{,}>slot, because physics.sty prints that argument as an auto-sized fence. A delimiter separated from the command by a group is now literal, and FlattenGroups keeps that group, as in{\cos}(x)or\cos{}(x). An unclosed parenthesis such as\sin(xis a parse error withphysics, as in LaTeX; across the regression datasets, 144 more formulas fail to parse withphysicsloaded.
Added
- Compact output keeps only lexically required spaces and omits braces around a script that is a single character, a single prime,
~, or a known command without argument slots, adding a readability space before a following ASCII letter or digit (\frac{a}{b}+x_i^2,x^2 3). Scripts holding a command with argument slots, an unknown command, or a declarative switch keep their braces, as inx^{\sin}[2]withphysicsorx^{\rm}a. Compact output preserves the parsed structure and is text-idempotent; its layout may improve across releases. texform normalize --style spaced|compactapplies to text,--json, and--reportoutput, and theserveconfigurerequest accepts an optionalstyleand echoes it inresolved.tokenizealways uses spaced output.- Faithful rules expand physics named functions for renderers without physics.
physics/named-fn-paren-expandrewrites\sin(x)and\sin[n](x), and the same forms of the other\trigbracesnames that have base commands, to\sin\left(x\right)and\sin^{n}\left(x\right);\sin[n]without parentheses is unchanged.physics/physics-operator-fence-expandfences the argument of\exp,\det, and\Pr.physics/named-fn-to-operatornamerewrites physics-only names such as\asin,\csch,\tr,\erf, and\Traceto\operatorname, with the same expansion where the name takes an argument. The explicit fence is an inner atom, so it can add up to 1/6 em on each side; the rules declareReadingfidelity.
Fixed
- FlattenGroups keeps a group when splicing it would let a known command read the following token as an omitted trailing optional, star, group, or delimited argument. With
physics,\sin{[2]}x,{\sin}[2]x, and\sin{}[2]xno longer become\sin[2]x, and{\qty}(a)no longer becomes\qty(a);\text{a{\\}*b}no longer becomes\text{a\\*b}. The protection applies in every profile, and reports count it asguard_hits.argument_capture(argumentCapturein JavaScript). - Equiv rules that drop a fixed delimiter size no longer expose the delimiter to the preceding command:
a\\\big[x\big]becomesa\\{}[x]instead ofa\\[x], which reparsedxas the line-break dimension, and withphysics\ln\Bigr[x\Bigr]no longer becomes\ln[x]. - The physics authoring aliases
sine-to-sin,cosine-to-cos,naturallogarithm-to-ln,probability-to-pr,trace-to-tr, andtrace-capital-to-Trrename only a command not followed by(,[, or a brace group.\trace(\rho)and\Probability(\frac{x}{y})no longer gain an auto-sized fence, and\sine(x)no longer fails the conformance check inauthoringor stops later rules infaithful. - With
abort_on_error, a failure inside a command argument is reported at its source:a+\frac{1},a+\hspace{x}, anda+\text{$x}no longer point ata, andarrayandalignare no longer reported as unknown or as not allowed in text mode. An unclosed inline$is reported at its opener in strict and non-strict parsing. Which inputs fail is unchanged. - Trees built with
from_syntaxkeep a space after a control-word delimiter such as\langle, or an error snippet ending in a control word, before an ASCII letter, and after a math-mode control sequence before a sibling[or*. Serialized output of parsed input is unchanged.