Commit Graph

419 Commits

Author SHA1 Message Date
Emily Eisenberg
2600587f78 Update master version numbers
Summary: Update the version numbers on master to <the-next-version>-pre.

Test plan:
 - ???

Auditors: kevinb, alpert
2015-07-16 14:20:29 -07:00
Emily Eisenberg
ce99abd1f2 Update Dockerfile for ttfautohint, update metrics
Summary:
Update the MathJaxFonts `Dockerfile` to enable the use of
`ttfautohint` which hints our fonts better. Also, fix the location that
batik is downloaded from, update some formatting in the `Dockerfile`,
and update the fonts and metrics.

Test Plan:
 - Compare a rendered `= - A z 4 \Longrightarrow \Sigma \Biggl(` in
   Chrome on Windows at font sizes 10px to 20px before and after this
   change.
 - See that characters look about the same, or better.
 - See that the screenshot tests didn't change in firefox (maybe firefox
   runs the same autohinting algorithm that we do?), and don't visually
   change in chrome

Reviewers: kevinb, alpert

Reviewed By: kevinb, alpert

Differential Revision: https://phabricator.khanacademy.org/D18977
2015-07-16 12:01:26 -07:00
Martin von Gagern
fb403fa9eb Switch Screenshotter data from JSON to YAML
Escaping TeX in JSON as query strings is a pain: you have to double all the
\\, you have to escape the & and the #, you can't easily include line breaks
for readability, and so on.  YAML solves most of these problems for most of
the situations.  Now each test case can be structured, while simple test
cases only consist of a line of verbatim TeX code, with no escaping.

The most troublesome items remaining are lines starting in { since in YAML
these would denote inline mapping types. We use block notation for these.
2015-07-16 08:57:17 +02:00
Kevin Barabash
a3031af307 Merge pull request #308 from gagern/selenium-images
Automatically start a development server
2015-07-15 07:50:37 -06:00
Kevin Barabash
e0c75df7b7 Merge pull request #309 from gagern/chromeScreenshotUpdates
Update chrome screenshots
2015-07-15 07:49:45 -06:00
Martin von Gagern
9752d02748 Automatically start a development server
This avoids one of the few requirements we have left: you no longer have to
start a KaTeX development server, the script will do it for you, using a
random port number.

To reproduce the old behaviour, explicitely state --katex-port=7936.
2015-07-15 15:41:29 +02:00
Martin von Gagern
b7e1581869 Update chrome screenshots
I forgot to re-create these after rebasing.
2015-07-15 15:40:31 +02:00
Kevin Barabash
a18db36296 Merge pull request #264 from gagern/selenium-images
Selenium images
2015-07-14 10:13:56 -06:00
Martin von Gagern
6f65f685f3 Add screenshots taken from Chrome 2015-07-14 18:09:58 +02:00
Martin von Gagern
5d155c75db Switch from own docker image to standard selenium images
Since the Selenium images are available for download, and downloading them
is usually faster than building them from scratch, this makes taking
screenshots easier.  Furthermore, since the Selenium image is not specific
to KaTeX, it could as well be used for other purposes, thus saving space
since a single image can be used in multiple projects.

This change also deals with the non-determinism in the Lap screenshot:
We detect the one known (and accepted) alternate rendering and change the
output file name to Lap_alt in this case.  So either Lap or Lap_alt gets
saved to, and if the image is different from both, then one of these files
will show a modification.  On the other hand, if it is equal to either of
these, then the matching one will get overwritten, showing no change.
2015-07-14 18:09:58 +02:00
Kevin Barabash
b1d5311898 Merge pull request #306 from gagern/browserifyUpdate
Update development server for new browserify version
2015-07-14 06:56:50 -06:00
Martin von Gagern
11970ee965 Update development server for new browserify version
Current browserify no longer accepts an options hash to the bundle method.
2015-07-14 09:51:20 +02:00
Kevin Barabash
67147b18ac Adds font metrics to support font commands.
This is part 1 of 3.  Rendering, screenshots, MathML, and unit tests will
follow in susbequent pull requests.
2015-07-10 21:50:04 -06:00
Kevin Barabash
549c2bf858 Merge pull request #293 from gagern/matrices
Matrices should be of type ord
2015-07-10 09:52:49 -06:00
Martin von Gagern
6362e0f8f2 Test case demonstrating the desired spacing around an array 2015-07-10 17:37:53 +02:00
Martin von Gagern
8bff74ca09 Change group type of array from inner to ord
This is a consequence of Rule 8 of Appendix G of The Tex Book.
2015-07-10 17:37:53 +02:00
Martin von Gagern
f05ff9c5fa Offer some help working out the types of math formula atoms 2015-07-10 17:36:52 +02:00
Kevin Barabash
6357a34828 Merge pull request #303 from gagern/metrics
Improve font metrics creation
2015-07-10 09:07:59 -06:00
Martin von Gagern
b290d4ad76 Switch from fontforge to fonttools
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.
2015-07-10 14:32:02 +02:00
Martin von Gagern
d26a67f220 Avoid non-determinisms related to font metric generation
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.
2015-07-10 14:30:42 +02:00
Martin von Gagern
86115b8fce Format font metrix data to have one row for each glyph
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.
2015-07-10 14:30:42 +02:00
Martin von Gagern
1603162267 Save auto-generated font metrics data to separate JSON file
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.
2015-07-10 14:30:41 +02:00
Martin von Gagern
1f8610cebe Auto-detect python binary
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”.
2015-07-09 14:44:01 +02:00
Kevin Barabash
6cf8c5aacb add a link to Examining TeX page on wiki to CONTRIBUTING.md
Auditors: emily
2015-07-08 23:38:40 -06:00
Martin von Gagern
7c8ea80638 Provide more delimiters
This adds \lgroup, \rgroup, \lmoustache and \rmoustache,
provides \lVert and \rVert with the correct type for each,
and makes \lvert, \rvert, \lVert and \rVert available
through \left...\right.
2015-07-09 02:23:33 +02:00
Kevin Barabash
8009059b7c Merge pull request #295 from gagern/fracspace
Improve horizontal spacing of fractions
2015-07-08 18:17:28 -06:00
Emily Eisenberg
d00caf6ed7 Merge pull request #298 from gagern/Bmatrix
Implement Bmatrix environment
2015-07-08 17:01:08 -07:00
Martin von Gagern
ec3cbb8656 Implement Bmatrix environment 2015-07-08 22:47:22 +02:00
Martin von Gagern
7dc8b68092 Improve horizontal spacing of fractions
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.
2015-07-07 10:03:34 +02:00
Kevin Barabash
a06744e941 Merge pull request #268 from gagern/texcmp
Generate reference images from LaTeX
2015-07-06 21:04:39 -06:00
Martin von Gagern
c562813afa Take snapshots of formulas rendered by LaTeX and compute visual diffs
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.
2015-07-06 15:54:14 +02:00
Kevin Barabash
7be056c1f4 Merge pull request #283 from kevinb7/kevinb7-patch-4
Update CONTRIBUTING.md
2015-07-03 10:17:09 -06:00
Kevin Barabash
53b0a9ad7a Update CONTRIBUTING.md
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
2015-07-03 10:14:06 -06:00
Kevin Barabash
87b2cc95bf Merge pull request #284 from kevinb7/kevinb7-patch-5
Updated Makefile so that it "make dist" works on OS X
2015-07-02 14:36:28 -06:00
Kevin Barabash
2e9fdee780 Merge pull request #285 from kevinb7/kevinb7-patch-6
Added a link to the list of commands on the wiki.
2015-07-02 14:34:24 -06:00
Kevin Barabash
1a11eb46b2 Added a link to the list of commands on the wiki. 2015-07-01 20:21:55 -06:00
Kevin Barabash
39489ab479 Update Makefile
```cp --recursive``` isn't supported on Mac OS X so use ```cp -R``` instead.
2015-07-01 20:18:40 -06:00
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
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
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
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