Commit Graph

7 Commits

Author SHA1 Message Date
Emily Eisenberg
d61a04c80d Fix up small problems with #126
Summary:
 - Some of the symbols were of the wrong type (I wrote some scripts to
   search the TeX source for the correct types for the symbols; I should
   put these somewhere for future reference)
 - Some of the symbols had the incorrect unicode replacement value. I
   copied what MathJax used for the ones that were wrong. In one case,
   something had the wrong font, so I used the one MathJax used.
 - Some symbols were duplicates of existing symbols, those were removed.
 - Some symbols are text symbols that aren't usable in math mode (maybe
   they should be text symbols?) (`\aa`, `\AA`, etc.)
 - Some symbols didn't seem to work/I couldn't figure out how to make
   them work. For example, `\imath` and `\jmath` require an italic font
   in KaTeX_Main, but we don't have the ability to do that yet. `\dots`
   was removed because it's not an ordinary symbol. `\*vert` were
   removed because I don't understand what they're for, nor what they
   should look like.
 - Some symbols weren't actually in the KaTeX fonts; to make sure they
   don't fall back to something weird, I removed them. (`\S`, `\pounds`,
   etc.)

Test plan:
 - `make test`
 - See that all of the symbols in: `\equiv \prec \succ \sim \perp
   \preceq \succeq \simeq \mid \ll \gg \asymp \parallel \bowtie \smile
   \sqsubseteq \sqsupseteq \doteq \frown \ni \propto \vdash \dashv \owns
   \ldotp \cdotp \aleph \forall \hbar \exists \nabla \flat \ell \natural
   \clubsuit \wp \sharp \diamondsuit \Re \heartsuit \Im \spadesuit
   \rmoustache \lmoustache \rgroup \lgroup \mp \ominus \uplus \sqcap
   \ast \sqcup \bigcirc \bullet \ddagger \wr \amalg \longleftarrow
   \Leftarrow \Longleftarrow \longrightarrow \Rightarrow \Longrightarrow
   \leftrightarrow \longleftrightarrow \Leftrightarrow
   \Longleftrightarrow \mapsto \longmapsto \nearrow \hookleftarrow
   \hookrightarrow \searrow \leftharpoonup \rightharpoonup \swarrow
   \leftharpoondown \rightharpoondown \nwarrow \rightleftharpoons \nless
   \nleqslant \nleqq \lneq \lneqq \lvertneqq \lnsim \lnapprox \nprec
   \npreceq \precnsim \precnapprox \nsim \nshortmid \nmid \nvdash
   \nvDash \ntriangleleft \ntrianglelefteq \subsetneq \varsubsetneq
   \subsetneqq \varsubsetneqq \ngtr \ngeqslant \ngeqq \gneq \gneqq
   \gvertneqq \gnsim \gnapprox \nsucc \nsucceq \succnsim \succnapprox
   \ncong \nshortparallel \nparallel \nVDash \ntriangleright
   \ntrianglerighteq \nsupseteqq \supsetneq \varsupsetneq \supsetneqq
   \varsupsetneqq \nVdash \precneqq \succneqq \nsubseteqq \unlhd \unrhd
   \nleftarrow \nrightarrow \nLeftarrow \nRightarrow \nleftrightarrow
   \nLeftrightarrow \vartriangle \hslash \triangledown \lozenge
   \circledS \measuredangle \nexists \mho \Finv \Game \Bbbk \backprime
   \blacktriangle \blacktriangledown \blacksquare \blacklozenge \bigstar
   \sphericalangle \complement \eth \diagup \diagdown \square \Box
   \Diamond \beth \daleth \gimel \digamma \varkappa \ulcorner \urcorner
   \llcorner \lrcorner \leqq \leqslant \eqslantless \lesssim \lessapprox
   \approxeq \lessdot \lll \lessgtr \lesseqgtr \lesseqqgtr \doteqdot
   \risingdotseq \fallingdotseq \backsim \backsimeq \subseteqq \Subset
   \sqsubset \preccurlyeq \curlyeqprec \precsim \precapprox
   \vartriangleleft \trianglelefteq \vDash \Vvdash \smallsmile
   \smallfrown \bumpeq \Bumpeq \geqq \geqslant \eqslantgtr \gtrsim
   \gtrapprox \gtrdot \ggg \gtrless \gtreqless \gtreqqless \eqcirc
   \circeq \triangleq \thicksim \thickapprox \supseteqq \Supset
   \sqsupset \succcurlyeq \curlyeqsucc \succsim \succapprox
   \vartriangleright \trianglerighteq \Vdash \shortmid \shortparallel
   \between \pitchfork \varpropto \blacktriangleleft \therefore
   \backepsilon \blacktriangleright \because \llless \gggtr \lhd \rhd
   \eqsim \Join \Doteq \dotplus \smallsetminus \Cap \Cup \doublebarwedge
   \boxminus \boxplus \divideontimes \ltimes \rtimes \leftthreetimes
   \rightthreetimes \curlywedge \curlyvee \circleddash \circledast
   \centerdot \intercal \doublecap \doublecup \boxtimes \dashrightarrow
   \dashleftarrow \leftleftarrows \leftrightarrows \Lleftarrow
   \twoheadleftarrow \leftarrowtail \looparrowleft \leftrightharpoons
   \curvearrowleft \circlearrowleft \Lsh \upuparrows \upharpoonleft
   \downharpoonleft \multimap \leftrightsquigarrow \rightrightarrows
   \rightleftarrows \twoheadrightarrow \rightarrowtail \looparrowright
   \curvearrowright \circlearrowright \Rsh \downdownarrows
   \upharpoonright \downharpoonright \rightsquigarrow \leadsto
   \Rrightarrow \restriction \yen \dag \ddag` look the same as they do
   in LaTeX and don't print any warnings about unknown font metrics.

Auditors: alpert
2015-02-18 16:28:05 -08:00
Emily Eisenberg
b7e55607cc Add skew and italic metrics for ttfs
Summary:
Add the ability to base the metrics for a TTF character on the metrics
from one of the TFM characters.

Test Plan:
 - Make sure the tests still work
 - Make sure huxley tests didn't change

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D13217
2014-09-16 17:40:20 -07:00
Emily Eisenberg
e6b3cbe7c1 Add font metrics for \iint, \iiint
Also, fix the python dict keys so we actually get the metrics back into the
javascript correctly.

Fixes #56

Auditors: alpert
2014-09-16 16:00:30 -07:00
Emily Eisenberg
0dca731da6 Add accents
Summary:
Add support for math-mode accents. This involves a couple changes.
First, in order to correctly position the accents, we must know the kern between
every character and the "skewchar" in that font. To do this, we improve our tfm
parser to run the mini-kern-language and calculate kerns. We then export these
into fontMetrics.js.

Then, we add normal support for accents. In particular, we do some special
handling for supsubs around accents. This involves building the supsub
separately without the accent, and then replacing its base with the built
accent.

Finally, the character in the fonts for the \vec command is a combining unicode
character, so it is shifted to the left, but none of the other characters do
this. We add some special handling for \vec to account for this.

Fixes #7

Test Plan:
 - Make sure tests pass
 - Make sure no huxley screenshots changed, and the new one looks good

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D13157
2014-09-13 21:30:35 -07:00
Emily Eisenberg
79ab06d88d Get rid of the lookahead-y dots
Summary:
The `\dots` and `\dots{c,o,b,i,m}` commands do more than just show characters,
they add extra space and `\dots` also looks ahead to determine what kind of
environment it is in (see [this math.sx post]
(http://tex.stackexchange.com/questions/122491/difference-of-the-dots)). We
can't support that yet, so remove them.

Also, add comments to the extract_ttf script to show what caracters we are
extracting metrics for.

Test Plan: - Make sure tests work

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D13151
2014-09-12 17:29:49 -07:00
Emily Eisenberg
6ee2ecf47e Add \dots commands
Add all of the \dots commands, and import their metrics from the ttf files.

Fixes #23

Auditors: alpert
2014-09-12 15:02:18 -07:00
Emily Eisenberg
71da6aa50f Add the ability to extract metrics from ttfs
Summary:
Upon switching over from ttf metrics to TeX metrics, we lost metrics for a
couple of the characters that are dynamically generated by TeX. Thus TeX doesn't
have metrics for them, but our fonts do have the characters because the MathJax
scripts also dynamically build them. This adds the ability to extract metrics
from the generated font files so that we can use the generated characters
correctly. A better solution would be to dynamically generate the characters
ourselves, but that is much harder, and will be left to a future time.

Test Plan:
 - Make sure typing "\neq \cong \text{ }" produces no warnings in the console.
 - Make sure huxley screenshots look the same

Reviewers: alpert

Reviewed By: alpert

Differential Revision: http://phabricator.khanacademy.org/D13107
2014-09-12 14:59:28 -07:00