Add support for \expandafter, \noexpand, \edef, \let, and \long (#2122)

* Add support for \expandafter

* Add support for \noexpand

* Add support for \edef

* Update comments

* Allow \long before macro definition

* Update documentation

* Update comments

* Fix defPrefix

* Add support for \let

* Update documentation

* Print error token

* Update documentation

* Check whether command is expandable

* Add tests

* Fix token order

* Make noexpand a Token property

* Throw error if control sequence is undefined when expanding

* Rename expandableOnly to expandOnly

* Make unexpandable macro property

* Move \expandafter to macros.js

* Add TODO

* Fix merge conflict

* Update a test case

* Remove unused functions in MacroContextInterface

* Update comments

* Refactor code

* Move \noexpand to macros

* Update MacroExpander.js

* Add a test case

* Separate control sequence check to a function

* Add support for \futurelet

* Separate RHS getter to a function

* Update documentation

* Move expandOnly logic to expandOnce

* Refactor code and update comments

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
This commit is contained in:
ylemkimon
2020-03-11 12:14:34 +09:00
committed by GitHub
parent d6a4379b49
commit 9917d1ce84
9 changed files with 319 additions and 27 deletions

View File

@@ -24,6 +24,9 @@ title: Common Issues
behavior matches MathJax with its `color.js` extension enabled.
- Equivalents of MathJax `\class`, `\cssId`, and `\style` are `\htmlClass`,
`\htmlId`, and `\htmlStyle`, respectively, to avoid ambiguity.
- Some symbols are defined using macro instead of `\DeclareMathSymbol` or similar
as in LaTeX. This may cause different behavior in expansion. They may expand
into multiple tokens and be affected by `\expandafter` and `\noexpand`.
## Troubleshooting