133 Commits

Author SHA1 Message Date
Erik Demaine
9e3ae4d5a8 feat: Support \Braket, \set, and \Set (#3214)
* feat: Support \Braket, \set, and \Set

* Update screenshots.

* Rewrite to redefine | via macros

* Update screenshot after merge

* Rename \bra@ket@one -> \bra@set

* Fix spacing in \set and \Set to match braket.sty

* Add || and \| support

* Update tests

* Update screenshots

Co-authored-by: Ron Kok <ronkok@comcast.net>
2022-05-20 17:26:04 +00:00
Erik Demaine
52c4778b15 feat: \nonumber/\notag support, \tag per row of {align} (#2952)
* feat: \nonumber and \notag support

Support `\nonumber` (and equivalent `\notag`) using a global macro
`\@eqnsw` to track whether one occurs in each row, similar to how
amsmath uses global `\@eqnswtrue`/`\@eqnswfalse`.

Fix #2950

* Remove duplicate mention of align*

* Working version of \tag within {align}

* Simpler subparse mechanism

* Fix flow errors, clarifying set-to-undefined

* Document that \tag works in rows

* Add screenshot tests

* Add Jest tests

* Add Safari screenshot

* Commit message about fixing \tag

Fixes #2379

* Apply suggestions from code review

Co-authored-by: ylemkimon <y@ylem.kim>

* Revise and move getAutoTag

* Fix handling of split

* Remove unnecessary feedTokens

Co-authored-by: ylemkimon <y@ylem.kim>

Co-authored-by: ylemkimon <y@ylem.kim>
2021-11-01 06:40:06 +09:00
Ron Kok
9b4acc971c fix: Correct for negative margin in integrand lower limits (#2987)
* fix: Correct for negative margin in integrand lower limits.

* Adjust for width limit.

* Update screenshots.

* Update Safari screenshot.

* Catch null subGroup.

* Remove redundant code.
2021-05-11 21:26:35 -04:00
Ron Kok
980b004023 fix: binom delimiter size in scriptscriptstyle. (#2976)
Co-authored-by: Erik Demaine <edemaine@mit.edu>
2021-05-06 18:27:10 +00:00
Ron Kok
1f509a3b75 feat: Support \underbar (#2713)
* feat: Support \underbar

* Update screenshots
2020-12-30 10:15:17 -05:00
Ron Kok
75a3af9725 feat: Support {CD} (#2396)
* Support {CD}

* Edit screenshotter test to fit on one page

* Update screenshots

* Remove bogus Safari screenshot

* Edit documentation to avoid tag conflicts and explain delimiters

* Add type annotations

* Add bogus safari screenshot

* Update with real Safari screenshot

* Set label vertical alignment

* Revise call to parseExpression() per PR 2085 changes to macro parsing

* Update Firefox screenshot

* Pick up review comments

* Add unit tests and snapshot.

* Tighten up label collection.

* Better loop index

* remove extra space

* Picked up comments. Added a parse check. Added a test.

Co-authored-by: ylemkimon <y@ylem.kim>
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
Co-authored-by: Kevin Barabash <kevinb7@gmail.com>
2020-12-27 13:45:31 -05:00
Ron Kok
60aecbdfe2 feat: Support \vcenter and \hbox (#2452)
* Support \vcenter, \raise, \lower, and \hbox

* Update screenshots

* Edit docs for strict and hbox to

* Fix typo for \hbox to

* Update Safari screenshot

* Augment docs for \vcentcolon

* Edit vcenter MathML comment.

* Remove pointless class from vcenter MathML

* Withdraw \raise and \lower

* Updatae Chrome and Firefox screenshots

* Update Safari screenshot

* Delete allowedInArgument setting

Co-authored-by: ylemkimon <y@ylem.kim>

* Update Chrome and Firefox screenshots

* Update Chrome and Firefox screenshots take 2

* Update screenshot

Co-authored-by: ylemkimon <y@ylem.kim>
2020-11-14 18:45:14 +09:00
Ron Kok
37990cc5b3 feat: Support matrix*, pmatrix*, bmatrix*, Bmatrix*, vmatrix*, and Vmatrix*. (#2488)
* Support matrix*, pmatrix*, bmatrix*, Bmatrix*, vmatrix*, and Vmatrix*

* Add tests and docs

* Delete screeshotter tests

* Fix column alignment and add bogus screenshot files

* Update real Chrome and Firefox screenshots.

* Update Safari screenshot

* Dedupe code in array.js

* Edit payload in array.js

* Edit again, correctly this time.
2020-09-06 09:56:09 -07:00
Ron Kok
42cc5e507e feat: Support \phase (#2406)
* Support \phase

* Update screenshots

* Update documentation

* Add a11y test

* Edit MathML notation to phasorangle

* Move code to enclose.js

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-08-13 00:08:36 -04:00
Ron Kok
26e0a05221 feat: Support \mathstrut (#2416)
* feat: Support \mathstrut

* Update screenshots
2020-08-12 23:45:33 -04:00
Ron Kok
ab5936a6e7 feat: support {equation}, {equation*}, and {split} (#2369)
* Support {equation}, {equation*}, and {split}

* Update screenshots

* Allow {split} at top level

* Move equation column number check to to ParseArray

* Add token to ParseError

* Sharpen parameters passed to parseArray

* Add token information

* Update an {array} spec in screenshotter

* Adjust {array} screenshotter spec

* Make a non-strict error call when {array} argument specifies too few columns.

* Move context checks to a helper function.
2020-08-04 01:35:41 +09:00
Ron Kok
2f37dc9104 feat: support {align}, {align*}, {alignat}, and {alignat*} (#2341)
* Support {align}, {align*}, {alignat}, and {alignat*}

* Specify display mode for screenshots

* Add bogus screenshots

* Some screenshotter progress

* Update screenshots
2020-07-29 00:02:08 +09:00
Ron Kok
80b0e3dc20 Support {gather} and {gather*} (#2183)
* Support `gather` and `gather*`

* Add bogus screenshots

* Add correct screenshots

* Fix typo

* Update screenshots

* Improve error handling

* Scope styles inside .katex{}

* Revert console.log to console.error
2020-07-27 06:56:39 -07:00
Ron Kok
e76857ec03 feat: support \angl and \angln (#2334)
* Support \angl and \angln

* Update screenshots

* Update documentation
2020-07-25 22:53:11 +09:00
Ron Kok
1764d25048 Support \minuso (#2213)
* Support \minuso

* Update screenshots

* Add MathML version

* Add BIN spacing

* Update screenshots

* Add Unicode character

* Delete duplicate macro

Co-authored-by: Erik Demaine <edemaine@mit.edu>
2020-07-08 19:28:43 -04:00
Ron Kok
d6e8575942 Fix jagged parentheses (#2234)
* Fix jagged parentheses

* Update screenshots

* Coordinate overlap with repeat element length.

* Fix lint error.

Co-authored-by: Erik Demaine <edemaine@mit.edu>
2020-07-08 18:20:42 -04:00
Ron Kok
d49da10d79 Fix under accent depth (#2252)
* Fix under accent depth

* Update screenshots
2020-05-02 18:16:36 +09:00
ylemkimon
e5333ad04d Add HTML extension (#2082)
* Add html extension

* Fix flow error

* Update documentation

* Add tests

* Call buildA11yStrings for "html" node

* Throw ParseError when parsing \htmlData fails

* Improve documentation

* Add a screenshotter test

* Add dummy screenshot

* Update screenshots
2019-12-01 17:49:28 -05:00
Ron Kok
d1cee3cf3d Support {rcases} and {drcases} (#2149)
* Support {rcases} and {drcases}

* Fix lint error

* Update screenshots
2019-11-10 18:36:02 +09:00
Ron Kok
a92e39d810 Fix laps
* Fix lap with flex

* Fix lint error

* Fix more lint errors

* Fix indentation in test spec

* Update screenshots

* remove .glue class
2019-11-01 02:23:28 +09:00
Erik Demaine
285c9fe0b6 Re includegraphics (#2053)
* Re-enable \includegraphics now that we have trust setting

This reverts commit 5806b240b3.

* Include Khan Academy test logo in repo and use in test (fix #1892)

* Update screenshots

* Update documentation

* Add tests, cleanup existing tests

* Update snapshots

* Enable trust testing (trust=true by default)
2019-07-22 00:15:29 +09:00
Erik Demaine
9c7f26b479 Fix argument font sizing in \fbox and \raisebox, fix font sizing in \TeX, \LaTeX, \KaTeX (#1787)
* Remove forced \normalsize in \raisebox

Fix #1786 (incorrect size of "E" in `\TeX`) by fixing `\raisebox` to
keep the current font size.  Previously, `\raisebox` was rendering its
second argument as if it were in `\normalsize\textrm{...}`; now,
the argument is just as if it were in `\textrm{...}`.

* Fix screenshots

* New "hbox" argument type to convert box-like arguments

* Review comments

* Fix \fbox to use hbox argument

* Render A in \LaTeX and \KaTeX in \scriptstyle (not \scriptsize)

* Add screenshot test

* Revert .sizing { width: min-content} thanks to #2044
2019-07-18 11:24:00 -04:00
Ron Kok
2dc8f8121a Support \operatorname* (#1899)
* Support \operatorname*

* Fix lint errors

* Fix YAML

* Update screenshots

* Break out a function to avoid code duplication

* Fix lint errors

* Restore wrapper span

* Update docs

* Reinstall color macros lost in merge

* Update screenshots

* Add type annotations, Move to utils file, add \limits to screenshots

* Fix lint errors

* Rearrange screen shot to fit onto page

* Update screenshots

* tweak location of utils.js and assembleSupSup.js
2019-07-17 21:38:44 -04:00
Erik Demaine
08df67b7cd Fix font choice in operators like \log (e.g. \boldsymbol{\log}) (#2041)
* Fix font choice in operators like \log (e.g. \boldsymbol{\log})

Fix #1971 by correctly passing arguments into the font choice for
the HTML handler for operators like \log.

* Extend BoldSymbol screenshot test

* Require options argument in mathsym to avoid this type of bug in the future

* Update screenshot
2019-07-16 15:08:17 -07:00
Ron Kok
fc79f79c78 Support Unicode \digamma (#2010)
* Support Unicode \digamma

* Update screenshotter images
2019-07-05 20:01:51 -04:00
Erik Demaine
19d9d83ad3 \color affects following \right, put array cells in their own groups (#1845)
* \color affects following \right

Fix #1844 by giving `leftright` nodes a `rightColor` attribute for how
to color the right bracket.  Now `\color` sets the macro
`\current@color` in the current environment (in particular, resetting
after `\right`), just like `color.sty` does in LaTeX.  This is used to
specially pass the current color into any following `\right` and then
into the `leftright` parse node.

* Add test

* Put each array cell in its own group/namespace

* Improve cell group isolation, add test and TODO

* Improve comments
2019-07-05 00:27:55 -04:00
Ron Kok
f9dafea6a6 Enable minRuleThickness in rendering options (#1964)
* Enable minRuleThickness in rendering options

* fix typo

* Fix lint errors

* Fix default

* Remove border from \colorbox

* Fix lint error

* Update array screenshot

* Add border to \fcolorbox

* Edit comment

* Add comment

* Pick up review comments

* Fix lint errors

* Edit \sqrt screenshot test

* Update screenshots

* Screenshot update take 2

* Improve \sqrt SVG paths

* Fix lint error
2019-05-25 18:39:16 -04:00
Ron Kok
3b60aee16c Support {smallmatrix}, {subarray}, and \substack (#1969)
* Support {smallmatrix}, {subarray}, and \substack

* Fix lint errors

* Update docs. Screenshots step 1.

* Screenshots step 2

* Screenshots step 3

* Pick up review comments

* Fixed arraycolsep for {smallmatrix}

* Fixed lint error

* Updated screenshots
2019-05-20 23:34:49 -04:00
Kevin Barabash
5806b240b3 disable \includegraphics until trust settings is merged (#1951)
* disable \includegraphics until trust settings is merged

* disable one more test
2019-04-28 17:52:27 -04:00
Ron Kok
64d1c4e590 Fix nested \dfrac (#1825)
* Fix nested \dfrac

* Update screen shots
2019-03-20 14:20:01 -04:00
Ron Kok
f5234a2f01 Fix \hphantom width (#1809)
* Fix \hphantom width

* Spin up phony screenshot test

* Make better choice of smash screenshot test

* Real screenshotter test

* Add strict mode

* Fix lint error

* useStrictBehavior

* Revert to previous strict setting

* useStrictBehavior "phantomSpacing"

* Fix tests via nonstrictSettings

* Fix documentation

* Remove bin|rel
2019-01-02 01:49:23 +09:00
Ron Kok
f713f324bd Support \includegraphics (#1620)
* Support \includegraphics

* Update screenshots

* Fix lint errors

* Fix more lint errors

* Fix lint errors take 3

* Add documentation, error messages

* Improve CSS

* Update domTree to coordinate with PR #1633

* Update screenshots

* fix flow errors

* Use same RegEx as href

* Fix lint error

* Accept raw ArgType

* Fix lint error

* fix flow error

* Add test
2018-11-01 18:43:41 -04:00
ylemkimon
ba8e224b8d Fix \mathit font and italic correction and add \mathnormal (#1700)
* Fix \mathit font (Math-Italic -> Main-Italic) and italic correction

* Rename mathit to mathdefault and mainit to mathit

* Add \mathnormal
2018-10-10 17:18:07 +09:00
Ron Kok
98dd7fc912 Fix \Large roots (#1485)
* Fix roots

* Update screenshots

* Added a test in a craven gambit to get a green check mark

* Adjust small radicals

* Fix lint error

* Update screenshots
2018-08-08 08:46:04 +09:00
Ron Kok
b2d38104cd Fix \fbox (#1550)
* Fix \fbox

* Fix lint errors

* Change negative space test from \fbox to \boxed
2018-08-04 20:32:06 -07:00
Ron Kok
aef9256419 Fix wide characters (#1549)
* Fix wide characters

* Add phony screenshots

* Try again with screenshotter

* Screenshotter general edit

* Getting closer

* Fix screenshotter test

* Update screenshots
2018-08-05 12:26:20 +09:00
Ron Kok
b43ed4b645 Support \pmb (#1418)
* Support \pmb

* Fix lint error

* Add phony screenshots

* Screenshots take two

* Screenshots take three

* Simplify copies

* Move determination of mclass from handler to htmlBuilder

* Change to a macro definition

* Update screenshots

* Pick up review comments

* Clean up nesting of braces

* Update screenshot
2018-07-22 17:46:12 -04:00
Ron Kok
db585fae54 Support \genfrac and \above (#1458)
* Support \genfrac and \above

* Accommodate delimiters inside groups

* Update screenshots take one`

* Update screenshots take two

* Fix flow error

* Fix lint error
2018-07-07 17:01:37 -07:00
Ron Kok
8621f5b76a Support \brace and \brack (#1453)
* Support \brace and \brack

* Update screenshots
2018-06-28 03:43:02 +09:00
Ryan Randall
062f8fbdbd Phantom text (#1449)
* Enabling phantom in text mode.

* Adding screenshots.
2018-06-26 17:50:20 +09:00
Ron Kok
3e932b1ecb Support \oiint and \oiiint (#1430)
* Support \oiint and \oiiint

* Fix sub. Add tests

* Add phony screenshots

* Add real screenshots
2018-06-19 09:41:00 -04:00
Erik Demaine
4a2903148e Automatic mrel/mbin spacing for \boldsymbol (#1388)
* Automatic mrel/mbin spacing for \boldsymbol

Fix #1154

* Add test

* Add missing mode

* Separate out \boldsymbol support to correct flow types

* Fix ternaries thanks to @ronkok's comment

* Revert package-lock.json

* Add screenshot test
2018-06-11 08:19:50 -04:00
Ron Kok
a5ef29fab1 Implement \colon as amsmath does (#1410)
* Implement \colon as amsmath does

* Remove \colon from symbols.js

* Update screenshots

* Pick up comments

* Replace screenshots
2018-06-07 04:24:41 +02:00
Ron Kok
93904c51ab Support \hdashline (#1407)
* Support \hdashline

Support `\hdashline` from package `arydshln`. This PR acts as a complement to PR #1395.

Similarly to #1395, the dashed line is rendered as `border-bottom-style: dashed;`. That does not exactly match the `dashsegment` and `dashgap` lengths in `arydshln`, but it does render black lines with sharp edges.

* Fixed top line position

* Add screenshots

* Fix lint error

* Fix another lint error

* Deleted HLine screenshots

* Pick up comments
2018-06-07 03:30:29 +02:00
Ron Kok
89e180c5a6 Support \widecheck (#1406)
Fixes #1221.

Implemented as an upside-down version of `\widehat`.
2018-06-04 21:05:07 -04:00
Erik Demaine
1e645198f7 Fix ligatures vs. \tt (#1379)
* Fix ligatures not always triggering

Example: \text{\rm --} would not cause ligature but should

* Remove ligatures in \texttt mode

* Add screenshot tests

* Fix MathML ligatures

* Fix type

* Handle \text... fonts in MathML building

* Remove leftover console deubgging
2018-06-04 20:29:25 -04:00
Zachary Riedlshah
4492eedb68 Added ability to create a dashed vertical line in arrays, using ':' (#1395)
* hacked together a dashed vertical bar

* Updated tests and spec.

* tidied up the screenshot template for arrays

* added the vertical lines at the end back

* Updated screenshots for arrays
2018-06-03 19:52:30 -04:00
Ron Kok
563b0d5f8f Improve \cancel (#1398)
* Fix \cancel

Fixes #1080.

Improve `\cancel` in three ways:

1. Better lateral spacing.
2. Steeper `\cancel` lines on single characters.
3. Treat height and depth to match the `cancel` package behavior, not its documentation.

* Update screenshots
2018-06-03 17:38:49 -04:00
Ron Kok
08b0045b92 Support \cfrac (#1392)
* Support \cfrac

This was an easier PR to write than #135 since KaTeX now has well established methods for pt-to-em conversions and nulldelimiter.

As in #135, this does not support the LaTeX optional argument for numerator justification.  It supports a `\cfrac #1 #2 ` syntax.

* Added screenshotter files

* fix ref to context in genfrac handler
2018-06-03 16:38:19 -04:00
Erik Demaine
3d5826c1da Implement \neq and \notin via macros like LaTeX's (#1400)
* Implement \neq and \notin via macros like LaTeX's

* Fix test
2018-06-03 16:01:16 -04:00