"preLaTeX" specification
Master marco mentioned that there is no documentation describing formally the syntax that texsurgery assumes for the document. My idea was that texsurgery should operate on a preLaTeX level, without expanding macros, which is a Turing-complete computing system. Otherwise, we should be writing a LaTeX package, which comes with all the problems we know.
My proposal: it should stay as close to possible to section The_LaTeX_syntax of the LaTeX wikibook, and ignore the rest of the wikibook.
A problem that arises: it is not specified how many arguments a command consumes
-
\frac
and get an error in standard LaTeX (or worse, it could capture the two following characters, or groups, and declare them numerator and denominator). -
\frac{num}
and get an error, as above. -
\frac{num}{dem}
and get a nice fraction in standard LaTeX. -
\frac{num}{dem}{rem}
and get a nice fraction in standard LaTeX, followed by the{rem}
tex group.
Proposed solution: all of them are valid preLaTeX.
-
\frac{num}{dem}
is parsed as three siblings: [\frac, num, dem] -
\frac{num}
is parsed as two siblings: [\frac, num, dem] and it is the responsibility of the selector to decide how many arguments are captured.
Opinions are welcome