diff --git a/src/commands/math/basicSymbols.ts b/src/commands/math/basicSymbols.ts index a59369a02..53d69eaa7 100644 --- a/src/commands/math/basicSymbols.ts +++ b/src/commands/math/basicSymbols.ts @@ -877,6 +877,8 @@ if (!CharCmds['\\']) CharCmds['\\'] = LatexCmds.backslash; LatexCmds.$ = bindVanillaSymbol('\\$', '$', 'dollar'); +LatexCmds['?'] = bindVanillaSymbol('?', '?', 'question mark'); + LatexCmds['□'] = LatexCmds.square = bindVanillaSymbol( '\\square ', '\u25A1', @@ -1447,7 +1449,7 @@ LatexCmds['÷'] = LatexCmds.div = LatexCmds.divide = LatexCmds.divides = - bindBinaryOperator('\\div ', '÷', '[/]', 'over'); + bindBinaryOperator('\\div ', '÷', '[/]', 'divided by'); class Sim extends BinaryOperator { constructor() { diff --git a/src/commands/math/commands.ts b/src/commands/math/commands.ts index 9a36aa642..da56fe0fe 100644 --- a/src/commands/math/commands.ts +++ b/src/commands/math/commands.ts @@ -884,7 +884,7 @@ var Fraction = var numText = getCtrlSeqsFromBlock(this.getEnd(L)); var denText = getCtrlSeqsFromBlock(this.getEnd(R)); - // Shorten mathspeak value for whole number fractions whose denominator is less than 10. + // Shorten mathspeak value for whole number fractions whose denominator has a special spoken form. if ( (!opts || !opts.ignoreShorthand) && intRgx.test(numText) && @@ -897,7 +897,7 @@ var Fraction = } else if (denText === '3') { newDenSpeech = isSingular ? 'third' : 'thirds'; } else if (denText === '4') { - newDenSpeech = isSingular ? 'quarter' : 'quarters'; + newDenSpeech = isSingular ? 'fourth' : 'fourths'; } else if (denText === '5') { newDenSpeech = isSingular ? 'fifth' : 'fifths'; } else if (denText === '6') { @@ -908,6 +908,14 @@ var Fraction = newDenSpeech = isSingular ? 'eighth' : 'eighths'; } else if (denText === '9') { newDenSpeech = isSingular ? 'ninth' : 'ninths'; + } else if (denText === '10') { + newDenSpeech = isSingular ? 'tenth' : 'tenths'; + } else if (denText === '11') { + newDenSpeech = isSingular ? 'eleventh' : 'elevenths'; + } else if (denText === '12') { + newDenSpeech = isSingular ? 'twelfth' : 'twelfths'; + } else if (denText === '100') { + newDenSpeech = isSingular ? 'hundredth' : 'hundredths'; } if (newDenSpeech !== '') { var output = ''; diff --git a/test/unit/typing.test.js b/test/unit/typing.test.js index 53808369b..776a91bf0 100644 --- a/test/unit/typing.test.js +++ b/test/unit/typing.test.js @@ -148,13 +148,13 @@ suite('typing with auto-replaces', function () { suite('MathspeakShorthand', function () { test('fractions', function () { - // Testing singular numeric fractions from 1/2 to 1/10 + // Testing singular numeric fractions from 1/2 to 1/112, and 1/100 mq.latex('\\frac{1}{2}'); assertMathspeak('1 half'); mq.latex('\\frac{1}{3}'); assertMathspeak('1 third'); mq.latex('\\frac{1}{4}'); - assertMathspeak('1 quarter'); + assertMathspeak('1 fourth'); mq.latex('\\frac{1}{5}'); assertMathspeak('1 fifth'); mq.latex('\\frac{1}{6}'); @@ -166,15 +166,21 @@ suite('typing with auto-replaces', function () { mq.latex('\\frac{1}{9}'); assertMathspeak('1 ninth'); mq.latex('\\frac{1}{10}'); - assertMathspeak('StartFraction, 1 Over 10, EndFraction'); - - // Testing plural numeric fractions from 31/2 to 31/10 + assertMathspeak('1 tenth'); + mq.latex('\\frac{1}{11}'); + assertMathspeak('1 eleventh'); + mq.latex('\\frac{1}{12}'); + assertMathspeak('1 twelfth'); + mq.latex('\\frac{1}{100}'); + assertMathspeak('1 hundredth'); + + // Testing plural numeric fractions from 31/2 to 31/12, and 31/100 mq.latex('\\frac{31}{2}'); assertMathspeak('31 halves'); mq.latex('\\frac{31}{3}'); assertMathspeak('31 thirds'); mq.latex('\\frac{31}{4}'); - assertMathspeak('31 quarters'); + assertMathspeak('31 fourths'); mq.latex('\\frac{31}{5}'); assertMathspeak('31 fifths'); mq.latex('\\frac{31}{6}'); @@ -186,7 +192,13 @@ suite('typing with auto-replaces', function () { mq.latex('\\frac{31}{9}'); assertMathspeak('31 ninths'); mq.latex('\\frac{31}{10}'); - assertMathspeak('StartFraction, 31 Over 10, EndFraction'); + assertMathspeak('31 tenths'); + mq.latex('\\frac{31}{11}'); + assertMathspeak('31 elevenths'); + mq.latex('\\frac{31}{12}'); + assertMathspeak('31 twelfths'); + mq.latex('\\frac{31}{100}'); + assertMathspeak('31 hundredths'); // Fractions with negative numerators should be shortened mq.latex('\\frac{-1}{2}'); @@ -194,7 +206,7 @@ suite('typing with auto-replaces', function () { mq.latex('\\frac{-3}{2}'); assertMathspeak('negative 3 halves'); mq.latex('-\\frac{3}{4}'); - assertMathspeak('negative 3 quarters'); + assertMathspeak('negative 3 fourths'); // Fractions with negative denominators should not be shortened mq.latex('\\frac{1}{-2}');