Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message with \vdotswithin{}. (mathjax/MathJax#3078) #981

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions ts/input/tex/mathtools/MathtoolsMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export const MathtoolsMethods: Record<string, ParseMethod> = {
*/
VDotsWithin(parser: TexParser, name: string) {
const top = parser.stack.Top() as EqnArrayItem;
const isFlush = (top.getProperty('flushspaceabove') === top.table.length);
const isFlush = (top.table && top.getProperty('flushspaceabove') === top.table.length);
const arg = '\\mmlToken{mi}{}' + parser.GetArgument(name) + '\\mmlToken{mi}{}';
const base = new TexParser(arg, parser.stack.env, parser.configuration).mml();
let mml = parser.create('node', 'mpadded', [
Expand Down Expand Up @@ -428,11 +428,15 @@ export const MathtoolsMethods: Record<string, ParseMethod> = {
ShortVDotsWithin(parser: TexParser, _name: string) {
const top = parser.stack.Top() as EqnArrayItem;
const star = parser.GetStar();
MathtoolsMethods.FlushSpaceAbove(parser, '\\MTFlushSpaceAbove');
!star && top.EndEntry();
if (top.EndEntry) {
MathtoolsMethods.FlushSpaceAbove(parser, '\\MTFlushSpaceAbove');
!star && top.EndEntry();
}
MathtoolsMethods.VDotsWithin(parser, '\\vdotswithin');
star && top.EndEntry();
MathtoolsMethods.FlushSpaceBelow(parser, '\\MTFlushSpaceBelow');
if (top.EndEntry) {
star && top.EndEntry();
MathtoolsMethods.FlushSpaceBelow(parser, '\\MTFlushSpaceBelow');
}
},

/**
Expand All @@ -443,8 +447,10 @@ export const MathtoolsMethods: Record<string, ParseMethod> = {
*/
FlushSpaceAbove(parser: TexParser, name: string) {
const top = MathtoolsUtil.checkAlignment(parser, name);
top.setProperty('flushspaceabove', top.table.length); // marker so \vdotswithin can shorten its height
top.addRowSpacing('-' + parser.options.mathtools['shortvdotsadjustabove']);
if (top.table) {
top.setProperty('flushspaceabove', top.table.length); // marker so \vdotswithin can shorten its height
top.addRowSpacing('-' + parser.options.mathtools['shortvdotsadjustabove']);
}
},

/**
Expand All @@ -455,9 +461,11 @@ export const MathtoolsMethods: Record<string, ParseMethod> = {
*/
FlushSpaceBelow(parser: TexParser, name: string) {
const top = MathtoolsUtil.checkAlignment(parser, name);
top.Size() && top.EndEntry();
top.EndRow();
top.addRowSpacing('-' + parser.options.mathtools['shortvdotsadjustbelow']);
if (top.table) {
top.Size() && top.EndEntry();
top.EndRow();
top.addRowSpacing('-' + parser.options.mathtools['shortvdotsadjustbelow']);
}
},

/**
Expand Down