The dependencies of fonttools are much lighter than fontforge, and since all
we need are some metrics, fonttools is very much up to that task.
This addresses issue #288.
We had some duplicate mappings in mappings to start with. Now we have some
code to complain loudly about these, and all currently existing duplicates
have been dealt with.
We also had a problem where in some Python dict, existing stuff was using
strings as keys while new data would use numeric indices, thus not
overwriting the previous value. Now we always use strings as keys.
Along the road, the italic dotless i and j symbols were changed
so that they now are taken from cmmi10 instead of cmti10.
This will make reviewing modifications easier, since the affected glyphs
will be more readily visible in the diff.
The formatting tool was applied to the existing data, instead of
regenerating the data, so the semantic content should be unmodified.
This separates auto-generated code from manually created code.
We need a more recent version of browserify to directly require JSON.
Note that the data was copied, not recreated, so it has not been changed.
This addresses issue #301.
We now try whether there is an executable called python2, and if so,
use that in preference to python when executing the metric computation.
Furthermore, we allow the user to specify the path of the python binary
using the PYTHON variable of make, i.e. “make PYTHON=/foo/python2 metrics”.
A fraction is surrounded by a box of width \nulldelimiterspace on either side.
That size is 1.2pt and does not scale with the style or font size.
Furthermore, a \frac creates a brace-enclosed group which results in a
\mathord, not a \mathinner.
The same test cases we use for our screenshots from Firefox are now also
being rendered by pdflatex, so the resulting images can be used as reference
for how things are supposed to look (if we concentrate on compatibility with
LaTeX). To make comparisons even easier, the differences between LaTeX and
Firefox snapshots are rendered in a visual way, using different colors.
Discussed in pull request #268.
added "Pull Requests" section with some guidelines, plus some addition code style guidelines.
fix grammar and be more specific about splitting large pull request
Update CONTRIBUTING.md
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
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
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
- 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
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
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
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.
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.
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
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
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