Previously, the matrix family of environments assumed that the number of
columns was given by the number of columns in the first row. This
didn't work when there were zero rows, and it didn't handle the case
where future rows have more columns than the first (which is visible
when using an alignment other than `c`, such as `\begin{matrix*}[r]`).
Fixes#3017
Co-authored-by: ylemkimon <y@ylem.kim>
* feat: Allow text-mode accents in math mode, except in strict mode
LaTeX only issues a warning when using e.g. `\r` in math mode.
KaTeX will now do the same with the default `strict` setting of `warn`.
Fixes#2983
* Fix accent mode
Co-authored-by: ylemkimon <y@ylem.kim>
* fix#2990
fix make stretchycode to textNode bug.
* fix: fix stretchy.js@mathMLnode line too long
* chore(screenshotter): update stretchy snapshots
* fix: remove dup '\' in cdrightarrow cdleftarrow and cdlongequal
* test: add stretchy MathML builder test case
Co-authored-by: nferzhuang <nferzhuang@tencent.com>
Co-authored-by: Ron Kok <ronkok@comcast.net>
* feat: \operatornamewithlimits (and clean up \operatorname support)
Add support for `\operatornamewithlimits` (an alias to `\operatorname*`
defined in `amsmath/amsopn.sty`), and use KaTeX's existing `\@ifstar`
macro to define `\operatorname` instead of a special lexing rule
(simplifying the lexer).
* Pick up one comment
* Actually fix docs this time
Co-authored-by: Ron Kok <ronkok@comcast.net>
* fix: Correctly parse \ followed by whitespace
LaTeX parses `\` followed by whitespace including up to one newline
as equivalent to `\ `. (With multiple newlines, you get paragraph
breaks.)
Fix#2860.
* Improve comments
* Avoid second RegExp match in control words
* Document capturing groups
Co-authored-by: Ron Kok <ronkok@comcast.net>
Support single characters having a catcode of 13 (active) or 12 (other),
and expand a macro defined for the character only if it's active.
This enables defining `~` as a macro, but avoiding expansion in URLs.
Fix#2924
Co-authored-by: ylemkimon <y@ylem.kim>
* fix: Protect fraction bars from CSS border-color
`border-color` is not inheritable, so the previous fix did not work.
* Fix lint
Co-authored-by: Erik Demaine <edemaine@mit.edu>
* Combine characters together in all expressions
Call `tryCombineChars` in `buildExpression`
* update screenshots, exclude 'coverage' from lint
* update MathML snapshots
* don't combine two 'mbin's or two 'mord's
* update screenshots
* update screenshots
Co-authored-by: ylemkimon <y@ylem.kim>
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
* Support {CD}
* Edit screenshotter test to fit on one page
* Update screenshots
* Remove bogus Safari screenshot
* Edit documentation to avoid tag conflicts and explain delimiters
* Add type annotations
* Add bogus safari screenshot
* Update with real Safari screenshot
* Set label vertical alignment
* Revise call to parseExpression() per PR 2085 changes to macro parsing
* Update Firefox screenshot
* Pick up review comments
* Add unit tests and snapshot.
* Tighten up label collection.
* Better loop index
* remove extra space
* Picked up comments. Added a parse check. Added a test.
Co-authored-by: ylemkimon <y@ylem.kim>
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
Co-authored-by: Kevin Barabash <kevinb7@gmail.com>
* Remove `greediness` property
Use boolean `grouped` property instead, which is more consistent with
LaTeX.
BREAKING CHANGE: \cfrac, \color, \textcolor, \colorbox, \fcolorbox are
no longer grouped.
* Rename grouped to allowedInArgument
* Reenable tests
* Update documentation
* Fix typo
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
* Support {equation}, {equation*}, and {split}
* Update screenshots
* Allow {split} at top level
* Move equation column number check to to ParseArray
* Add token to ParseError
* Sharpen parameters passed to parseArray
* Add token information
* Update an {array} spec in screenshotter
* Adjust {array} screenshotter spec
* Make a non-strict error call when {array} argument specifies too few columns.
* Move context checks to a helper function.
* Bump flow version
* Bump jest version
* Bump eslint version
* Bump rollup version
* Bump webpack version
* Bump misc dependencies and update lockfile
* Update lockfile
* Bump commander version
* Bump misc dependencies
* Bump istanbul version
* Bump docusaurus version
* Update lockfile
* Explicitly declare dependencies
* Bump caniuse-lite version
* Update lockfile
* Bump commander version
* Bump webpack and css-loader version
* Bump flow version
* Reorganize some glyphs
* Remove mathdefault
Numerals are textord and it was never reachable.
* Use PUA for \imath and \jmath
* Update katex-fonts
* Update tests
* Update src/buildCommon.js
* Update screenshots
* Add comment regarding usage of PUA in \imath and \jmath
* Update fonts
Co-authored-by: Erik Demaine <edemaine@mit.edu>