fix: space should prevent optional argument to \\ (#3746)

Fix `src/functions/cr.js`'s definition of `\\` to manually look for an
optional argument via `future()` instead of `numOptionalArgs`, so that
it does *not* skip over spaces.  This matches the existing behavior of
`\\` in `src/environments/array.js` and AMSMath's behavior of `\math@cr`
via `\new@ifnextchar`.

Fixes #3745

Co-authored-by: Ron Kok <ronkok@comcast.net>
This commit is contained in:
Erik Demaine
2022-12-07 18:01:07 -05:00
committed by GitHub
parent 3db8e34719
commit a0deb3410f
2 changed files with 8 additions and 3 deletions

View File

@@ -13,13 +13,13 @@ defineFunction({
names: ["\\\\"],
props: {
numArgs: 0,
numOptionalArgs: 1,
argTypes: ["size"],
numOptionalArgs: 0,
allowedInText: true,
},
handler({parser}, args, optArgs) {
const size = optArgs[0];
const size = parser.gullet.future().text === "[" ?
parser.parseSizeGroup(true) : null;
const newLine = !parser.settings.displayMode ||
!parser.settings.useStrictBehavior(
"newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " +