Commit Graph

882 Commits

Author SHA1 Message Date
Erik Demaine
d822f04b9b \kern generates right-margin instead of left-margin. Fix #995 (#1019)
* \kern generates padding instead of margin. Fix #995

* Switch to marginRight

* Add screenshot tests
2017-12-28 23:03:08 -07:00
Kevin Barabash
7702ffa5b6 add package-lock.json so our builds are repeatable 2017-12-28 22:54:56 -07:00
Kevin Barabash
d470cc0b3f Add a 'common issues' section to the README (#1034) 2017-12-27 08:51:20 -08:00
Kevin Barabash
7229f02d8f Implement correct macros for liminf and limsup, fixes #111 (#887)
* Implement correct macros for liminf and limsup, fixes #111

* fix nits
2017-12-26 17:11:10 -07:00
Ryan Randall
c883b3d54d Merge pull request #1037 from rrandallcainc/Removing-Unnecessary-CSS
Removing katex-logo css, as it's no longer used.
2017-12-26 18:50:36 -05:00
Kevin Barabash
1dd1082628 Merge branch 'master' into Removing-Unnecessary-CSS 2017-12-26 16:30:49 -07:00
Ron Kok
c62f814765 Fix frac-line (#1025)
* Fix frac lline

For frac-line, use an SVG line in an extra tall span.

I still need to think of a way to adust `vertical-separator`.

* Fix spaces in katex.less

* regenerate screenshots

* update HorizontalBraces and StrikeThrough screenshots
2017-12-26 16:17:06 -07:00
Ryan Randall
c559b916da Removing katex-logo css, as it's no longer used. 2017-12-26 16:35:01 -05:00
Erik Demaine
d6791b7961 Make accents zero width (#1033)
* Make accents zero width

Make the width of an accented character equal to the width of the character,
by making accents zero width.  In particular, fixes #1028 (`\ddot\imath`).

This involved reworking all of the accent offset machinery, in particular
skew and accent-hungarian.  A bit cleaner now.

Also added support for the new width character metrics in symbolNode.

* Update AccentsText test

* Fix comment
2017-12-25 11:48:32 -07:00
Kevin Barabash
d19ac4029a add glyph widths to fontMetricsData.js (#1032) 2017-12-22 13:10:11 -07:00
Kevin Barabash
522b238e20 add \ae, \AE, \oe, \OE, \o, \O, \ss with unicode support for those characters in text mode (#1030) 2017-12-22 12:42:43 -07:00
Kevin Barabash
2b2cf73f2e add \i and \j for text mode (#1029) 2017-12-22 13:57:31 -05:00
Erik Demaine
c30edaaf5b Implement \TextOrMath, \@secondoftwo (#1024)
* Implement \TextOrMath, \@secondoftwo

* Parser now tells MacroExpander about mode switching.  (This seems preferable
  to a circular reference between Parser and MacroExpander.)
* Implement \TextOrMath
* Improve when we switch modes so that this actually works,
  in all cases except single-symbol arguments.
* Add \@secondoftwo to match \@firstoftwo.
* Add comments documenting all the conditional macros

* Define type for switchMode

* Fix mode detection for ligatures

* Switch mode before the call to parseSymbol() in parseGroup

This fixes the Colorbox screenshot test.
2017-12-21 21:43:27 -07:00
Ryan Randall
2d439f076a Merge pull request #1022 from edemaine/buildhtml
Add buildHTMLTree
2017-12-18 16:49:03 -05:00
Erik Demaine
d8994df1d4 Rename to use 'render' terminology, add docs 2017-12-18 11:24:50 -05:00
Erik Demaine
4b69eb7a7e Add buildHTMLTree 2017-12-18 11:24:50 -05:00
Ron Kok
4410d48d5c Fix \vec (#1018)
* Fix \vec

In accent \vec, replace the combining font glyph with an SVG.

* Fix lint error

* update screenshots containing vectors

* update HorizontalBraces
2017-12-17 22:05:21 -07:00
Ryan Randall
50765a0ccd Stacking text commands (#1009)
* Adding support for SansSerif-Bold

* Updating to include SansSerif Italic.

* WIP

* Working text stacking

* More robust screenshot.

* Don't want to break users :)

* Updating per PR comments.

* Fixing Unicode and updating snapshots.

* Adding suggested tests.

* Opting to use old method for unit testing.

* Adding TODO
2017-12-13 09:10:23 -05:00
Alexander Terenin
cf23517499 Added support for bold italic symbols (#1011)
* added support for \boldsymbol

* added \boldsymbol tests

* added \boldsymbol screenshots

* added \bm, snapshot, updated screenshots

* updated snapshot for \boldsymbol

* properly display \imath and 2 in boldsymbol

* implemented \boldsymbol for +

* fix typo, remove boldsymbolLetters hardcode

* make comment about using Main-Bold more general

* fixed trailing space CI error
2017-12-12 23:09:52 -05:00
Ryan Randall
36ca9beaa7 Exposing the build tree. (#1017)
* Exposing the build tree.

* Warning users about internal representation.
2017-12-10 20:03:10 -05:00
Ron Kok
46176c1d69 Support Unicode middle dot (#1015)
* Support Unicode middle dot

This PR adds support for Unicode characters U+00B7 MIDDLE DOT and U+22C5 DOT OPERATOR.

* Use escapes for tests. Edit macro comment.
2017-12-10 16:16:45 -05:00
Ashish Myles
73db0a2352 delimiter.js: Don't assign sizeMultiplier to span in prep for porting to flow. (#1006) 2017-12-06 21:54:57 -05:00
Kevin Barabash
9e6eb3a219 replace dockers/MathJaxFonts with KaTeX/katex-fonts submodule (#891) 2017-11-28 07:25:03 -05:00
Kevin Barabash
4cbc4d3cd9 cache node_modules on travis-ci, fixes #1001 (#1002) 2017-11-28 00:42:51 -05:00
Ron Kok
28c55ebedc Change \xLongequal to \xlongequal (#997)
Fix a spelling mistake from PR #670.
2017-11-27 23:55:51 -05:00
Kevin Barabash
1b20414526 extract color and text commands into their own files in functions sub-directory (#998) 2017-11-27 23:50:07 -05:00
Kevin Barabash
98203ad6ba extract overline, underline, and rule into their own files (#999) 2017-11-27 23:42:55 -05:00
Erik Demaine
7036eb85cd \kern fixes, \hskip support, \TeX, \LaTeX, \KaTeX (#974)
* Refactor \kern, proper \mkern support, add \hskip

* Move \kern, \mkern into functions directory
* Add \hskip, \mskip support (but without supporting plus/minus)
* Properly separate \kern, \hskip from \mkern, \mskip.
  (The former work in both modes, and don't support mu units.
  The latter work only in math mode and only support mu units.)

* Render \kern etc. using MathML <mspace>

* Implement \TeX macro

* Implement \LaTeX

* New KaTeX logo \katex

* Rename hskip.js -> kern.js

* Tweak katex \kern to 0.16em

* \katex kern -.17em

* Compute A raise height in \LaTeX and \katex

* Switch mu unit errors to warnings

* LaTeX screenshot test

* Replace \KaTeX with macro definition

* Update screenshots with \KaTeX in them

* Fix font selection for \*TeX macros
2017-11-27 14:40:38 -05:00
Erik Demaine
f6a377b91c Avoid negative space in \bmod. (#984)
This is a workaround for #836 for the command case of using \bmod,
without changing any spacing (and making the code and generated output
slightly more efficient).  In particular, fix #982.
2017-11-26 20:24:31 -05:00
Kevin Barabash
2ca6c3c73b Bump master to v0.10.0-pre 2017-11-26 18:34:59 -05:00
Ron Kok
0bde52f04f Support Unicode \mid (#993)
Map ∣, U+2223, to `\mid`
2017-11-26 18:32:01 -05:00
Ashish Myles
1d8cf3fa08 Port katex, buildTree, parseTree to @flow. (#989) 2017-11-25 22:10:14 -05:00
Ron Kok
dc0c3970c2 Support Unicode ∴ and ∵ (#991)
* Support Unicode ∴ and ∵

* Add comments
2017-11-25 20:00:58 -05:00
Erik Demaine
c103693dce "use strict" in ss_data.js (#986) 2017-11-25 18:14:53 -05:00
Ashish Myles
4a313d56a6 Simplify HTML generation logic for \\cancel, \\bcancel, \\xcancel. (#988) 2017-11-24 22:54:34 -05:00
Georges Dupéron
d773b17963 Adds \notni character ∌ (#710)
* Added \\not\\ni character ∌

* remove \notin from symbols.js

reason: we don't have the glyph yet
2017-11-24 16:01:29 -05:00
Erik Demaine
e93668c666 \hspace*, \@ifstar, \@ifnextchar, \@firstoftwo (#975)
* \hspace*, \@ifstar, \@ifnextchar, \@firstoftwo

* Support both \hspace and \hspace* (still aliasing to \kern)
  using new \@ifstar
* \@ifstar is a macro using new \@ifnextchar and \@firstoftwo
  (same definition as LaTeX)
* \@firstoftwo and \@ifnextchar use available MacroParser features
  to act as they do in LaTeX.
* Also new method pushTokens (which I almost used but didn't end up),
  and moved pushToken next to it and popToken.

* Fix flow errors; generalize MacroDefinition

* Add tests for macros
2017-11-24 14:48:04 -05:00
Ashish Myles
c8249c389f Port domTree and buildCommon to @flow. (#938)
* Port domTree to @flow.
* Port buildCommon to @flow.
* Change domTree attribute arrays to attribute objects.
2017-11-24 14:31:49 -05:00
Ron Kok
a02859033a Support Unicode Symbols (#950)
* Support Unicode Symbols

This is the third in a series of PRs to give KaTeX the ability to recognize Unicode character input. This one supports some but not all letter-like symbols and some other symbols. All the characters in this PR will produce `textord` atoms in `math` mode.

The list is not comprehensive. It’s a bit eclectic. Some of these characters are important. Others were just easy to include. A few important characters are omitted because it wasn’t clear to me which is the best way to implement them. I’ll address those characters in future PRs.

* Add comments. Remove RegEx.

* Fix omitted parens
2017-11-24 14:19:22 -05:00
Erik Demaine
ecad4de4ce Single-character macros like active characters (#973)
* Single-character macros like active characters

* Rewrite README according to @kevinbarabash's comment
2017-11-24 13:40:23 -05:00
Ron Kok
b2698d35ec Change frac-line from border to full span (#976)
* Change frac-line from border to full span

Change `frac-line`  and `vertical-separator`.  Instead of using span borders, fill entire span using a `box-shadow`.

This change will enable more dependable engagement of the `min-height` CSS.

* Fix indentation

* Fix indent again

* Change box shadow to inline SVG

* Fix lint error

* regenerate screenshots after switching to SVG for fraction bars
2017-11-24 11:41:53 -05:00
Hiromi Ishii
fd82c4fad0 Implemented `\href' command (#923)
* Implements `\href' command.

* Added `functions/href.js`.
* Added `domTree.anchor` and `buildCommon.makeAnchor` functions.
* Make `buildHTML.getTypeOfDomTree` exported.

* Reflects the code reviews

* Create new argType "url" to treat link string in math appropriately
* Stop using too shorten variable names
* Start using template strings

* Adopts template literal

* Elaborates on glueing

* If-clause restructuring

* Solved confusing explanation

* Allow balanced braces in url

* Adds unit-test for \href

* Adds snapshot tests
2017-11-23 23:23:35 -05:00
Ron Kok
75af19c5bb Change \undertilde to \utilde (#948)
* Change \undeertilde to \utilde

In PR #670, I made an error. The function that should have been `\utilde` I named instead `\undertilde`.

There is an `\undertilde` from the `wsuipa` package, but it is a text-mode non-stretchy function. The proper command name is `\utilde`, a math-mode, stretchy function from packge `undertilde`.

This PR fixes my error.

* Fix screenshotter test
2017-11-23 23:16:37 -05:00
Erik Demaine
d59647dfa7 Fix node_modules exclusion in webpack server (#981) 2017-11-22 22:01:05 -05:00
Erik Demaine
fd2544f8f9 Output port number of server, and lint fixes (#980) 2017-11-22 21:54:21 -05:00
Ron Kok
69aff05024 Support Unicode Big Operators (#961)
* Support Unicode Big Operators

This is the sixth in a series of PRs to give KaTeX the ability to recognize Unicode character input.

This is the final PR in this series that will submit characters in bulk. After this, there come some characters whose alias or atom type was not obvious. I'll turn in PRs for them, too, but only after they are vetted.

* Move constants outside of main functions

* Replace ∫ with \u222b

* Add backslash
2017-11-22 20:48:33 -05:00
Ron Kok
1f8a4f0490 Support Unicode Arrows (#947)
* Support Unicode Arrows

This is the second in a series of PRs to give KaTeX the ability to recognize Unicode character input.

All the characters in this PR will produce `rel` atoms.
2017-11-22 10:11:29 -05:00
Ron Kok
6325685a9f Support Unicode Negated Relations (#952)
* Support Unicode Negated Relations

This is the fifth in a series of PRs to give KaTeX the ability to recognize Unicode character input.

All the characters in this PR will produce `rel` atoms.

* Add parse tests

* Fix AMS functions

Fix a brain cramp.

* Add internal aliases to code comments
2017-11-22 08:37:53 -05:00
Ron Kok
22dd4f3a28 Append ApplyFunction to math functions (#960)
* Append ApplyFunction to math functions

As described at: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4

Character U+2061 is the same as &ApplyFunction;. Ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp

* Add comment for \u2061
2017-11-22 08:21:56 -05:00
Hiromi Ishii
6f1661f7da Implements \mathchoice command (#969)
This PR implements `\mathchoice` function.
I once created PR on the wrong branch. Sorry for the mess.

This is particularly useful when one defines custom macro for "big operators".
For example:

```latex
\newcommand{\infdisj}{%
  \mathop{%
    \mathchoice{% display
      \bigvee\hspace{-2ex}\bigvee%
    }{          % inline
      \bigvee\hspace{-1.75ex}\bigvee%
    }{          % script
      \bigvee\hspace{-1.4ex}\bigvee%
    }{          % scriptscript
      \bigvee\hspace{-1ex}\bigvee%
}}}
```
2017-11-22 07:34:05 -05:00