Commit Graph

470 Commits

Author SHA1 Message Date
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
Erik Demaine
c85250d14e fix: Correctly parse \ followed by whitespace (#2877)
* fix: Correctly parse \ followed by whitespace

LaTeX parses `\` followed by whitespace including up to one newline
as equivalent to `\ `.  (With multiple newlines, you get paragraph
breaks.)

Fix #2860.

* Improve comments

* Avoid second RegExp match in control words

* Document capturing groups

Co-authored-by: Ron Kok <ronkok@comcast.net>
2021-05-05 18:54:41 -07:00
Ron Kok
3f7163daf5 fix: Support \S and \P in math mode (#2977)
Co-authored-by: Erik Demaine <edemaine@mit.edu>
2021-05-02 15:57:39 -04:00
Ron Kok
fbda0b1136 fix: Avoid crash when \operatorname has \limits (#2979) 2021-05-02 15:47:22 -04:00
Erik Demaine
01ae7f8eef fix: Respect catcode in macro expansion and set ~'s catcode correctly (#2949)
Support single characters having a catcode of 13 (active) or 12 (other),
and expand a macro defined for the character only if it's active.
This enables defining `~` as a macro, but avoiding expansion in URLs.

Fix #2924

Co-authored-by: ylemkimon <y@ylem.kim>
2021-04-24 19:33:01 +00:00
Erik Demaine
24332e053c fix(array): Keep single empty row in AMS environments (#2947)
* fix(array): Keep single empty row in AMS environments

In particular prevents empty equation-numbered environment (e.g. `{align}`)
from crashing.

Fix #2944

* Add tests

Co-authored-by: ylemkimon <y@ylem.kim>
2021-04-24 19:28:16 +00:00
ylemkimon
c5b06e7eb9 chore: move test fonts to the main repo (#2834)
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2021-03-23 06:23:49 +00:00
ylemkimon
7300952ae1 test: update Firefox screenshots (#2845) 2021-03-22 13:54:23 +09:00
renovate[bot]
65cfd4bf86 chore(deps): update dependency js-yaml to v4 [skip netlify] (#2723)
* chore(deps): update dependency js-yaml to v4 [skip netlify]

* Update ss_data.js

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: ylemkimon <y@ylem.kim>
2021-01-12 04:38:18 +09:00
Ron Kok
84981da3bf fix: Remove topEnv parameter. (#2712)
* fix: Remove topEnv parameter.

* Set test to default strictness

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2021-01-11 10:00:03 -08:00
Erik Demaine
6b4e80bfbb fix(builder): combine characters together in all expressions (#2080)
* Combine characters together in all expressions

Call `tryCombineChars` in `buildExpression`

* update screenshots, exclude 'coverage' from lint

* update MathML snapshots

* don't combine two 'mbin's or two 'mord's

* update screenshots

* update screenshots

Co-authored-by: ylemkimon <y@ylem.kim>
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-12-30 10:34:01 -05:00
Ron Kok
1f509a3b75 feat: Support \underbar (#2713)
* feat: Support \underbar

* Update screenshots
2020-12-30 10:15:17 -05:00
Ron Kok
cd9ee27ac6 fix: Prevent global group from adversely affecting color. (#2703)
Co-authored-by: ylemkimon <y@ylem.kim>
2020-12-29 14:52:41 -05:00
Ron Kok
4a8a6a38ce fix: Use SVGs to avoid gaps in tall delimiters. (#2698)
* fix: Use SVGs to avoid gaps in tall delimiters.

* Add \vert and \Vert

* Update screenshots

* Define verts array outside of function.

* Revert height-finding logic.

* Update screenshots

* Pick up review comments.

* Update CD screen shots
2020-12-28 16:50:09 -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
ef09291288 fix: Improve MathML for math operators with subscripts (#2596)
* Improve MathML for math operators with subscripts

* Add TODO re: MathML spacing

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-12-18 18:14:12 -05:00
Ron Kok
17e86b985a fix: Remove premature CD screenshotter images (#2641)
* Remove premature CD screenshotter images

* Recommit for semantic pull request

Co-authored-by: ylemkimon <y@ylem.kim>
2020-11-15 05:48:48 +09:00
Ron Kok
753c82f360 fix: Support Armenian characters (#2618)
* Support Armenian characters

* Update docs

Co-authored-by: ylemkimon <y@ylem.kim>
2020-11-15 05:44:31 +09: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
c8042ccb55 fix: MathML \lim\limits in Safari (#2556)
Co-authored-by: ylemkimon <y@ylem.kim>
2020-10-03 21:11:24 +09:00
renovate[bot]
7418057e3a chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20200826 [skip netlify] (#2544)
* chore(deps): update selenium/standalone-firefox docker tag to v3.141.59-20200826 [skip netlify]

* Update screenshots

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: ylemkimon <y@ylem.kim>
2020-09-26 02:53:23 +09:00
renovate[bot]
94c374c7c1 chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20200826 [skip netlify] (#2543)
* chore(deps): update selenium/standalone-chrome docker tag to v3.141.59-20200826 [skip netlify]

* Update screenshots

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: ylemkimon <y@ylem.kim>
2020-09-26 02:04:28 +09:00
ylemkimon
5a90558116 feat(function): add allowedInArgument instead of greediness property (#2134)
* Remove `greediness` property

Use boolean `grouped` property instead, which is more consistent with 
LaTeX.

BREAKING CHANGE: \cfrac, \color, \textcolor, \colorbox, \fcolorbox are 
no longer grouped.

* Rename grouped to allowedInArgument

* Reenable tests

* Update documentation

* Fix typo

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-09-07 13:38:17 +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
ylemkimon
dc5f97aaa2 feat(macro): improve argument parsing (#2085)
* Improve macro argument parsing

* Make \above a primitive command

* Fix screenshotter data

* Normalize argument where necessary

* Improve argument location info

* Update comments

* Minor refactor

* Modularize group parsers

* Allow braced and blank size argument

for non-strict mode and \genfrac, respectively.

* Minor refactor & update comments

* Remove raw option in parseStringGroup

* Update tests

* Fix { delimited parameter

* Update tests

* Update tests

* Normalize argument in \genfrac

* Update tests

* Consume space before scanning an optional argument

* Fix \\, \newline, and \cr behavior

* Fix flow error

* Update comments

* Remove unnecessary mode switching

Parser mode affects neither fetch nor consume.

* Allow single (active) character macro

* Add function property `primitive`

* Set \mathchoice and \*style primitive

* Separate size-related improvements out to #2139

* Fix flow error

* Update screenshots

* Update demo example

* Add a migration guide

* Fix capitalization

* Make a primitive function unexpandable

* Update screenshots

* Update screenshots

* Revert "Document \def doesn't support delimiters (#2288) (#2289)"

This reverts commit f96fba6f7f.

* Update comments, errors, and tests

* Update screenshots
2020-09-06 12:56:13 +09:00
Ron Kok
010b267dd6 fix: Support MathML \oiint and \oiiint (#2461)
* fix: Support MathML \oiint and \oiiint

* Update direct input section of docs
2020-08-30 15:44:34 -07:00
Ron Kok
b22b69c3a8 fix: \injlim typo (#2459)
* Fix typo in \injlim

* Just to satisfy Semantic Pull Request
2020-08-26 09:14:18 -07:00
Ron Kok
794dc7a213 feat: support AMS log-like symbols (#2429)
* Support AMS log-like symbols

* Update documentation

* Update \limits info in documentation
2020-08-18 05:28:42 +09:00
Ron Kok
b59ca67530 feat: support Unicode ◯, U+25EF (#2430)
* Support Unicode U+25EF \bigcirc

* Update documentation
2020-08-17 20:35:24 +09:00
ylemkimon
babc60c428 test: add missing screenshots for safari (#2423) 2020-08-13 06:43:44 -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
ylemkimon
36f9788cd6 chore(screenshotter): support Browserstack and test on Safari 13.1 (#2306)
* Support Browserstack in screenshotter

* Support Browserstack in CircleCI

* Test screenshots on Safari 13.1

* Don't run Safari screenshotter on forked PRs

* Update a screenshot

* Ignore *.log in .gitignore
2020-08-04 01:45:10 +09: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
ylemkimon
4a6f776941 test: mock console implementation (#2363)
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-08-03 13:05:17 +09:00
ylemkimon
f9cd9de100 test(screenshotter): move coverage to Jest (#2324)
* Move screenshotter coverage collection to Jest testing

Fixes #1885.

* Update screenshotter-spec.js

* Update screenshotter-spec.js

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-08-02 17:58:40 -04:00
ylemkimon
1ffb638da8 Fix test/symgroups.js (#2314)
I forgot to change it in #1595.

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
2020-08-02 17:09:51 -04: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
05d1e7caf1 feat: support MathML \big, \bigg, \Big, and \Bigg (#2332)
* Support MathML \big, \bigg, etc

* Add stretchy attribute

* Update mathml-spec.js.snap

Co-authored-by: ylemkimon <y@ylem.kim>
2020-07-26 04:26:00 +09:00
ylemkimon
8a24907518 build(deps): update dependencies (#2301)
* Bump flow version

* Bump jest version

* Bump eslint version

* Bump rollup version

* Bump webpack version

* Bump misc dependencies and update lockfile

* Update lockfile

* Bump commander version

* Bump misc dependencies

* Bump istanbul version

* Bump docusaurus version

* Update lockfile

* Explicitly declare dependencies

* Bump caniuse-lite version

* Update lockfile

* Bump commander version

* Bump webpack and css-loader version

* Bump flow version
2020-07-25 11:38:29 -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
611fe6b698 Support \origof and \imageof (#2283)
* Support \origof and \imageof

* Fix documentation table

Co-authored-by: ylemkimon <mail@ylem.kim>
2020-07-17 17:20:23 +09:00
ylemkimon
3dd1ed45b4 Run screenshotter using Chrome 83 and Firefox 76 (#2304)
* Run screenshotter using Chrome 83 and Firefox 76

* Update screenshots

* Update NegativeSpace-chrome screenshot

The new screenshot is correct as per #1194.

* Update Units-chrome screenshot

The new screenshot is correct as per #732 and compared to Firefox.

* Update screenshots
2020-07-14 08:48:55 -07:00
ylemkimon
1a8f682155 Fix missing metrics for space (0x20) and no-break space (0xa0) (#2298)
* Fix missing metrics for space (0x20) and no-break space (0xa0)

* Update a screenshot

* Update font submodule

* Add a regression test
2020-07-13 03:38:34 +09:00
Ron Kok
2c5a3b8fdc Set MathML of \boldsymbol{textord} to bold, not bold-italic (#2299)
* Set \boldsymbol{textord} to bold, not bold-italic

* Finish adding files.
2020-07-11 21:10:11 -04:00
ylemkimon
d1c0468ef8 Reorganize some glyphs, simplify font selection, break \mathcal{123} (#2156)
* Reorganize some glyphs

* Remove mathdefault

Numerals are textord and it was never reachable.

* Use PUA for \imath and \jmath

* Update katex-fonts

* Update tests

* Update src/buildCommon.js

* Update screenshots

* Add comment regarding usage of PUA in \imath and \jmath

* Update fonts

Co-authored-by: Erik Demaine <edemaine@mit.edu>
2020-07-11 14:54:28 -04:00
Erik Demaine
1512de5b35 Reset to leftmost spacing mode after newline (#1841)
* Reset to leftmost spacing mode after newline

Newlines have class "mspace newline" but shouldn't be fully ignored:
they should reset the spacing mode back to "leftmost" so as to not
accidentally create trailing spaces at end of lines.  Fix #1828.

* Update snapshots

* Add root detection, and treat newline specially only then

Co-authored-by: ylemkimon <mail@ylem.kim>
2020-07-11 12:36:51 -04:00
Erik Demaine
7523e9714a \boldsymbol not italic for textords such as Greek (#2290)
* \boldsymbol not italic for textords such as Greek

Fix #2225: `\boldsymbol{\Omega}` will now produce a bold upright Omega
instead of a bold italic Omega.  This only affects `textord` symbols within
`\boldsymbol`, mimicking the no-font case in `makeOrd` which distinguishes
`textord` from `mathord` in a similar way.

* Update screenshots

Co-authored-by: Ron Kok <ronkok@comcast.net>
2020-07-09 09:22:33 -07: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