Commit Graph

3456 Commits

Author SHA1 Message Date
Kevin Barabash
1ac6b41990 Merge pull request #280 from JeffEverett/master
Add two AMS symbols: checkmark and circledR
2015-07-01 07:24:11 -06:00
Ben Alpert
6448ce5699 Update to katex 0.4.3, switch to bower for site
Auditors: emily
2015-07-01 11:23:42 +02:00
Jeff Everett
eaf89dd45d Add two AMS symbols: checkmark and circledR 2015-07-01 01:57:57 -06:00
Kevin Barabash
41e3fa6659 Merge pull request #279 from gagern/cases
Implement cases environment
2015-07-01 00:08:36 -06:00
Martin von Gagern
758bdba31e Implement cases environment
See issue #278.  Although the official definition makes use of @{…}
notation, we use custom spacing instead, since that seems easier for now.
2015-07-01 08:05:08 +02:00
Peter Krautzberger
31da784b6f Merge pull request #1 from mathjax/mj-node
update for MathJax v2.5 release, fixes #3
2015-06-30 21:43:13 +02:00
Davide P. Cervone
122ca09352 Fix problem with dot delimiter not being recognized as a delimiter because TEXDEF.delimiter[.] returns an empty string. Resolves issue #1199. 2015-06-29 10:23:32 -04:00
Davide P. Cervone
ca6ffc7b41 Use scale of 1 if bbox.scale is not set (affects fractions, for example). Resolves issue #1072. 2015-06-29 09:54:37 -04:00
Emily Eisenberg
7f1b53cbfd Fix arc lint
Summary: Move the linting configuration to `.arclint` so that `arc lint`
works again.

Test plan:
 - `arc lint`

Auditors: alpert
2015-06-26 13:57:02 -07:00
Emily Eisenberg
8931e5b45c Cleanup Makefile
Summary: Ensure that `make dist` is idempotent, and make sure comments
don't get printed out.

Test plan:
 - `make dist`
 - `make dist` again
 - See that there's no `katex` directory in `dist/`
 - See that no comments are printed out during `make dist`

Auditors: alpert
2015-06-20 12:22:04 -07:00
Emily Eisenberg
c18d3ad6c4 Remove font files and auto-render from bower's main
Summary: Bower's bower.json spec says to not include font/image files,
and only to include one file per filetype.

Test plan:
 - `make dist`, commit the result
 - Run `bower install /path/to/KaTeX#master` from /tmp
 - See that this succeeds, and `bower list --paths` has katex.min.js and
   katex.min.css for the KaTeX entry

Auditors: alpert, kevinb
2015-06-20 12:06:30 -07:00
Kevin Barabash
4ea7d38b5c Summary: add "main" field instead of "name" to bower.json
Test plan:
 - Run `bower install katex` from /tmp
 - Verify that there are no errors when running the command
 - Verify that `bower_components/katex/dist/` contains all the build files
 - Verify that the version is 0.4.2

Auditors: emily
2015-06-20 11:08:58 -06:00
Kevin Barabash
b11a1b97b7 Summary:
- Add "main" field to bower.json to prevent errors during installation.
- Bump version to 0.4.1 in bower.json and package.json

https://github.com/Khan/KaTeX/issues/181

Test plan:
 - Run `bower install katex` from /tmp
 - Verify that there are no errors when running the command
   and that `bower_components/katex/dist/` contains all the build files

Auditors: emily
2015-06-20 11:00:41 -06:00
Emily Eisenberg
c53ca01753 Update katex to v0.4.0 2015-06-18 19:27:08 -07:00
Emily Eisenberg
2060ebaf21 Add a bower.json
Summary: Add a bower.json so KaTeX can be included using bower.

Test plan:
 - Run `bower install /path/to/KaTeX#this-commit` from /tmp
 - See that `bower_components/KaTeX` contains only the full `dist/`
   directory

Auditors: alpert
2015-06-18 15:29:28 -07:00
Emily Eisenberg
75296a3fef Add a dist rule to the Makefile
Summary: Adds a `dist` rule to the Makefile which builds the `dist/`
directory with all of the built files in it.

Test plan:
 - `make dist`

Auditors: alpert
2015-06-18 15:22:12 -07:00
Kevin Barabash
32e8ffef4f Merge pull request #246 from gagern/matrices
Matrices, arrays, environments
2015-06-18 14:35:48 -06:00
Martin von Gagern
397dcb303b Simplify stacked delimiters
Using a loop to determine the number of symbols we need is intuitive but
hardly efficient.  A Math.ceil in this situation is much better.

After that ceil or the loop that it replaced, the total height should be
equal to the minimal height plus an integral number times the height of the
repeat symbol.  That integer equals (half) number of loop iterations in the
original code, and the repeatCount variable in my new code.  So later on,
the quotient (repeatHeight / repeatHeightTotal) should be an integer, at
least up to numeric errors.  Applying ceil instead of round to that is
asking for these numeric errors to seriously break stuff.  Just reusing the
repeatCount is much simpler, shorter and more elegant.

Having distinct topSymbolCount and bottomSymbolCount seems pointless, since
the only reason why these could ever be different is due to the fact that
bottomRepeatHeight was computed using topHeightTotal, which looks like a
bug.  The old loop and new ceil assume a symmetric repeatCount.
2015-06-18 22:24:40 +02:00
Martin von Gagern
2f7a54877a Implement environments, for arrays and matrices in particular
This commit introduces environments, and implements the parser
infrastructure to handle them, even including arguments after the
“\begin{name}” construct.  It also offers a way to turn array-like data
structures, i.e. delimited by “&” and “\\”, into nested arrays of groups.
Environments are essentially functions which call back to the parser to
parse their body.  It is their responsibility to stop at the next “\end”,
while the parser takes care of verifing that the names match between
“\begin” and “\end”.  The environment has to return a ParseResult, to
provide the position that goes with the resulting node.

One application of this is the “array” environment.  So far, it supports
column alignment, but no column separators, and no multi-column shorthands
using “*{…}”.  Building on the same infrastructure, there are “matrix”,
“pmatrix”, “bmatrix”, “vmatrix” and “Vmatrix” environments.  Internally
these are just “\left..\right” wrapped around an array with no margins at
its ends.  Spacing for arrays and matrices was derived from the LaTeX
sources, and comments indicate the appropriate references.

Now we have hard-wired breaks in parseExpression, to always break on “}”,
“\end”, “\right”, “&”, “\\” and “\cr”.  This means that these symbols are
never PART of an expression, at least not without some nesting.  They may
follow AFTER an expression, and the caller of parseExpression should be
expecting them.  The implicit groups for sizing or styling don't care what
ended the expression, which is all right for them.  We still have support
for breakOnToken, but now it is only used for “]” since that MAY be used to
terminate an optional argument, but otherwise it's an ordinary symbol.
2015-06-18 22:24:40 +02:00
Emily Eisenberg
5cf5617c09 Merge pull request #245 from mjbshaw/display-mode-cli
Add display mode to the CLI
2015-06-10 14:47:11 -07:00
Michael Bradshaw
42afd97f03 Add display mode to the CLI 2015-06-10 07:15:53 -07:00
Ben Alpert
0a0a3430b5 Bump version in README
Fixes #241.
2015-06-05 02:00:15 -07:00
hathix
9869d59cad Added new exercise colors as macros
Summary:
On https://app.asana.com/0/34646644303310/33935538887378, @eater requested we add some new colors to KaTeX, which lives in the spin-off Khan/KaTeX open source project. (See screenshot for colors.) I added these colors to KaTeX so math typesetting tools in exercises have access to them.

I used "blueA", "blueB", etc. because dashes and numbers aren't supported in KaTeX/LaTeX functions.

The actual mapping of color name => hex value is in "Options", and the listing of colors available for typesetting is in "functions".

See also https://phabricator.khanacademy.org/D18158 for the related additions to utils/math.js and KAthJax.

Test Plan:
- Set up the KaTeX dev environment (instructions taken from https://github.com/Khan/KaTeX/blob/master/CONTRIBUTING.md):
```
cd KaTeX
make setup
make serve
```
- Now that the server is up and running, visit http://localhost:7936/ to try live typesetting. Enter the following LaTeX code to try the new colors:
```
\blueE{e=mc^2}
```
- Try other new colors including \redD, \mintC, \grayH, \kaBlue, etc.
- Old colors like \orange should still work.
- Run the Jasmine test suite at http://localhost:7936/test/test.html.

Reviewers: emily

Reviewed By: emily

Subscribers: nataliefitzgerald, eater, cameron, david

Differential Revision: https://phabricator.khanacademy.org/D18152
2015-05-26 19:07:51 -07:00
Ben Alpert
8ed9e00439 Update demo to 0.3.0 2015-05-19 11:18:56 -07:00
John Resig
8691486392 Merge pull request #227 from jeresig/parseTree
Expose a new .__parse() method for generating a parse tree from a math expression
2015-05-07 11:09:48 -04:00
John Resig
b9eb8c74e0 Expose a new .__parse() method for generating a parse tree from a math expression. 2015-05-04 15:59:18 -04:00
Emily Eisenberg
c87b20aadd Merge pull request #225 from jeresig/clone-buildhtml
buildHTML's buildExpression is destructive, changing the tree object.
2015-05-01 11:43:09 -07:00
John Resig
3875af8763 buildHTML's buildExpression is destructive, changing the tree object, this clones the object first before manipulating it. 2015-05-01 11:53:22 -04:00
Davide P. Cervone
a154d7ded1 Merge branch 'hotfix-2.5.3' into develop 2015-04-30 17:51:07 -04:00
Peter Krautzberger
ba9afeb5a7 Merge pull request #1181 from mathjax/hotfix-2.5.3
Merge v2.5.3 for release
2015-04-30 23:26:13 +02:00
Davide P. Cervone
d7419676e2 Repack and recombine 2015-04-30 17:14:37 -04:00
Davide P. Cervone
72af812dfe Changed the wrong version number in the previous commit. 2015-04-30 17:13:44 -04:00
Davide P. Cervone
805986318b Change version numbers. 2015-04-30 15:27:45 -04:00
Davide P. Cervone
242c9356f5 Put off moving math in containers with display:none from the hidden div where they are typeset to their proper locations until AFTER they have been remeasured. Resolves issue #1179. 2015-04-30 13:44:03 -04:00
Davide P. Cervone
325f149ef7 Merge remote-tracking branch 'mathjax/hotfix-2.5.2' into develop 2015-04-29 10:54:31 -04:00
Peter Krautzberger
9995bf3fda Merge pull request #1166 from mathjax/hotfix-2.5.2
Merge v2.5.2 for release
2015-04-29 16:26:46 +02:00
Davide P. Cervone
e3f1a68bbe Make sure that paths with scale() transforms retain the scaling when they are translated. Issue #1176 and mathjax/MathJax-node#93. 2015-04-28 18:26:49 -04:00
Davide P. Cervone
7df7e227c5 Make sure the correct jax is passed to the postInputHooks. 2015-04-28 18:25:06 -04:00
Ben Alpert
1f90b36518 Add JSON as a global in .jshintrc 2015-04-26 17:22:42 -07:00
Ben Alpert
b29b8c40ea [auto-render] Don't stop parsing when one expression fails
Summary: Fixes #223.

Test Plan: Opened http://127.0.0.1:7936/contrib/auto-render/, saw `$\unsupported$` in page and error in console, but other expressions rendered. Made test.

Reviewers: emily

Reviewed By: emily

Differential Revision: https://phabricator.khanacademy.org/D17543
2015-04-26 17:04:11 -07:00
Davide P. Cervone
0360f44783 Merge pull request #1172 from christianp/var-in-global-scope
fix typo which put a variable in global scope
2015-04-23 06:59:42 -04:00
Christian Perfect
5d3ffd40f2 fix typo which put a variable in global scope
missing comma meant that SETTINGS was put in global scope
2015-04-23 08:56:34 +01:00
Emily Eisenberg
af8c1307f7 Add better lint checking.
Summary:
Make the lint checker check more files. Also, make arc run the
linter.

Test Plan:
 - `arc lint`
 - `make lint`

Reviewers: kevinb, alpert

Reviewed By: alpert

Differential Revision: https://phabricator.khanacademy.org/D17509
2015-04-22 18:55:20 -07:00
Emily Eisenberg
eef108b2dd Fix lint
Test plan:
 - `npm test`

Auditors: alpert
2015-04-22 15:33:26 -07:00
Emily Eisenberg
c48de165e8 Add optional arguments to \sqrt
Summary:
Use the TeX definitions of `\root` to get the optional `\sqrt`
argument in the right place. Also add the MathML version.

Fixes #48

Test Plan:
 - `make test`
 - See that the images look good

Reviewers: kevinb, alpert

Reviewed By: alpert

Differential Revision: https://phabricator.khanacademy.org/D17236
2015-04-22 15:26:10 -07:00
Davide P. Cervone
e533634f37 Add a postInputHooks list so that we can attach global filters like the MathML semantic enhancement filter. 2015-04-21 17:34:48 -04:00
Davide P. Cervone
6b73beacd5 Merge branch 'issue995' into develop. Issue #955. 2015-04-21 16:48:22 -04:00
Davide P. Cervone
d4b1fa042a Merge branch 'issue1072' into develop. Issue #1072. 2015-04-21 16:45:12 -04:00
Davide P. Cervone
2af7fde2d9 Merge branch 'issue1155' into develop. Issue #1155. 2015-04-21 16:44:38 -04:00
Davide P. Cervone
9290d82858 Merge branch 'issue928' into develop. Issue #928. 2015-04-21 16:43:56 -04:00