diff --git a/ts/input/tex/ColumnParser.ts b/ts/input/tex/ColumnParser.ts index 999d7c549..c898b3805 100644 --- a/ts/input/tex/ColumnParser.ts +++ b/ts/input/tex/ColumnParser.ts @@ -79,6 +79,7 @@ export class ColumnParser { '<': (state) => state.cend[state.j - 1] = (state.cend[state.j - 1] || '') + this.getBraces(state), '@': (state) => this.addAt(state, this.getBraces(state)), '!': (state) => this.addBang(state, this.getBraces(state)), + '*': (state) => this.repeat(state), // // Non-standard for math-mode versions // @@ -344,4 +345,20 @@ export class ColumnParser { cspace[++state.j] = '.5em'; } + /** + * Add a *{n}{...} entry + * + * @param {ColumnState} state The current state of the parser + */ + public repeat(state: ColumnState) { + const num = this.getBraces(state); + const cols = this.getBraces(state); + const n = parseInt(num); + if (String(n) !== num) { + throw new TexError('ColArgNotNum', 'First argument to %1 column specifier must be a number', '*'); + } + state.template = new Array(n).fill(cols).join('') + state.template.substr(state.i); + state.i = 0; + } + }