Skip to content

Difficult interaction between MacroExpander and Parser #924

@edemaine

Description

@edemaine

If \foo expands to a space (\def\foo{ }) or nothing (\def\foo{}), LaTeX will treat \frac\foo\foo just like \frac{}{}, i.e., two empty arguments. In KaTeX, in both cases, the arguments will get ignored (in math mode), so \frac\foo\foo x y will act just like \frac xy.

Another example: with \def\foo{foo}, \text\foo is equivalent to \text{foo} in LaTeX, but is treated as \text foo i.e. \text{f}oo in KaTeX.

One way to fix this is to move all function support into MacroExpander instead of Parser. I think a possible simpler fix is for MacroExpander to grab a function and its arguments, and then pass them on to Parser for actual handling.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions