Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvc committed Jun 5, 2024
1 parent ce1e3fd commit 0845074
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions ts/core/MmlTree/MmlNodes/mo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class MmlMo extends AbstractMmlTokenNode {
'\u2015', // overline and underline
'\u2190\u2192\u2194', // arrows
'\u23DC\u23DD', // over and under parens
'\u23DE\u23DF', // over and under braces
']$'
].join(''));

Expand Down
7 changes: 5 additions & 2 deletions ts/input/tex/base/BaseItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ export class PrimeItem extends BaseItem {
*/
public checkItem(item: StackItem): CheckType {
let [top0, top1] = this.Peek(2);
const isSup = NodeUtil.isType(top0, 'msubsup') && !NodeUtil.getChildAt(top0, (top0 as MmlMsubsup).sup);
const isOver = NodeUtil.isType(top0, 'munderover') && !NodeUtil.getChildAt(top0, (top0 as MmlMunderover).over);
const isSup = NodeUtil.isType(top0, 'msubsup') &&
!NodeUtil.getChildAt(top0, (top0 as MmlMsubsup).sup);
const isOver = NodeUtil.isType(top0, 'munderover') &&
!NodeUtil.getChildAt(top0, (top0 as MmlMunderover).over) &&
!NodeUtil.getProperty(top0, 'subsupOK');
if (!isSup && !isOver) {
// @test Prime, Double Prime
const node = this.create('node', top0.getProperty('movesupsub') ? 'mover' : 'msup', [top0, top1]);
Expand Down
14 changes: 7 additions & 7 deletions ts/input/tex/base/BaseMappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,13 @@ new sm.CommandMap('macros', {
tan: 'NamedFn',
tanh: 'NamedFn',

limits: ['Limits', 1],
nolimits: ['Limits', 0],
limits: ['Limits', true],
nolimits: ['Limits', false],

overline: ['UnderOver', '2015'],
underline: ['UnderOver', '2015'],
overbrace: ['UnderOver', '23DE', 1],
underbrace: ['UnderOver', '23DF', 1],
overbrace: ['UnderOver', '23DE', true],
underbrace: ['UnderOver', '23DF', true],
overparen: ['UnderOver', '23DC'],
underparen: ['UnderOver', '23DD'],
overrightarrow: ['UnderOver', '2192'],
Expand Down Expand Up @@ -650,10 +650,10 @@ new sm.CommandMap('macros', {
breve: ['Accent', '02D8'], // or 0306
check: ['Accent', '02C7'], // or 030C
hat: ['Accent', '005E'], // or 0302 or 02C6
vec: ['Accent', '2192'], // or 20D7
vec: ['Accent', '2192', false], // or 20D7
dot: ['Accent', '02D9'], // or 0307
widetilde: ['Accent', '007E', 1], // or 0303 or 02DC
widehat: ['Accent', '005E', 1], // or 0302 or 02C6
widetilde: ['Accent', '007E', true], // or 0303 or 02DC
widehat: ['Accent', '005E', true], // or 0302 or 02C6

matrix: 'Matrix',
array: 'Matrix',
Expand Down
21 changes: 13 additions & 8 deletions ts/input/tex/base/BaseMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ const BaseMethods: {[key: string]: ParseMethod} = {
base = parser.create('token', 'mi');
}
if ((NodeUtil.isType(base, 'msubsup') && !NodeUtil.isType(base, 'msup') &&
NodeUtil.getChildAt(base, (base as MmlMsubsup).sup)) ||
(NodeUtil.isType(base, 'munderover') && !NodeUtil.isType(base, 'mover') &&
NodeUtil.getChildAt(base, (base as MmlMunderover).over))) {
NodeUtil.getChildAt(base, (base as MmlMsubsup).sup)) ||
(NodeUtil.isType(base, 'munderover') && !NodeUtil.isType(base, 'mover') &&
NodeUtil.getChildAt(base, (base as MmlMunderover).over) &&
!NodeUtil.getProperty(base, 'subsupOK'))) {
// @test Double Prime Error
throw new TexError('DoubleExponentPrime',
'Prime causes double exponent: use braces to clarify');
Expand Down Expand Up @@ -496,10 +497,10 @@ const BaseMethods: {[key: string]: ParseMethod} = {
/**
* Handle a limits command for math operators.
* @param {TexParser} parser The calling parser.
* @param {string} name The macro name.
* @param {string} limits The limits arguments.
* @param {string} _name The macro name.
* @param {boolean} limits True for \limits, false for \nolimits.
*/
Limits(parser: TexParser, _name: string, limits: string) {
Limits(parser: TexParser, _name: string, limits: boolean) {
// @test Limits
let op = parser.stack.Prev(true);
// Get the texclass for the core operator.
Expand Down Expand Up @@ -645,13 +646,17 @@ const BaseMethods: {[key: string]: ParseMethod} = {
* @param {TexParser} parser The calling parser.
* @param {string} name The macro name.
* @param {string} accent The accent.
* @param {boolean} stretchy True if accent is stretchy.
* @param {boolean} stretchy True if accent is stretchy, false if mathaccent should be false.
*/
Accent(parser: TexParser, name: string, accent: string, stretchy: boolean) {
// @test Vector
const c = parser.ParseArg(name);
// @test Vector Font
const def = {...ParseUtil.getFontDef(parser), accent: true, mathaccent: true};
const def = {
...ParseUtil.getFontDef(parser),
accent: true,
mathaccent: stretchy === undefined ? true : stretchy
};
const entity = NodeUtil.createEntity(accent);
const moNode = parser.create('token', 'mo', def, entity);
const mml = moNode;
Expand Down

0 comments on commit 0845074

Please sign in to comment.