* Padding over \sqrt and Paths for frac-line
This replaces two earlier PRs.
* Restore reaction arrows
* regenerate screenshots
* Set line padding in a constant
* Update with latest master
* Fix lint error
* update screenshots
* Support Reaction Arrows
This PR is written to supply reaction arrows for a future `mhchem` extension. `mhchem` uses seven reaction arrows. Four of them correspond to extensible arrows already available in KaTeX. This PR creates the other three.
These arrows will also be useful to chemists writing about reactions when `mhchem` is unavailable.
Three new extensible arrows are introduced: `\xrightleftarrows`, `\xrightequilibrium`, and `\xleftequilibrium`.
These names are not `mhchem`’s user-facing function names. In `mhchem`, users would call these arrows with syntax such as: `\ce{A<-->B}`, or `\ce{A<=>>B}`, or `\ce{A<<=>B}`. I’ve provided names that look more like the other extensible arrow names. That’s probably worth some discussion.
* generate screenshots for ReactionArrows
* Increase overlap in arrow shaft
To prevent a small gap when rendering in very large font sizes.
* Adjust upper text vert alignment. Add warning.
* Limit alignment adjustment to \xleftequilibrium
* generate screenshots for reaction arrows
* Enable spacing functions in text mode
Spacing functions such as `\;` or `\quad` should be accepted in either math mode or text mode
* Add tests
* Fix tests
* Fix lint error
* update fonts and metrics so that accents are positioned correctly
* fix degree symbol, move more accents into the 0x2c0-0x2df range
* fix accents in Unicode screenshots
* update jest snapshots, update AccentsText to include requested characters
* update fonts submodule, add unicode chars to AccentsText test
* update submodules after merging its PR
We want to inherit CSS properties that apply to both text and SVG
but we don't want to inherit styles that affect SVG without affecting text.
This patch adds a screenshot test to verify this.
* Use JS for spacing between atoms instead of CSS
Summary:
This is the first step towards creating an intermediate representation
that can be used to generate HTML, SVG, and Canvas commands for rendering.
By generating spans that contain the width of the spaces instead of
relying on CSS sibling rules we'll be able to one day replaces the spans
with intermeidate 'Glue' nodes (in a later PR).
An added benefit of this approach is that is enables us to programmatically
change the values for thinspace, mediumspace, and thickspace which will
allow us to implement the \setlength command.
Test Plan:
- npm test
- dockers/Screenshotter/screenshotter.sh --verify
* fixed failures in BinCancellation, BoldSymbol, and OperatorName
* update screenshots
* don't use current size when determining size of spaces, update more screenshots
* fix spacing in SizingBaseline and StyleSwitching
* actually do the right thing for sizing groups
* fix \not for Chrome and Firefox
* do TODOs
* address feedback from the code review
* fix issue in delimsizing.js
* add TODO to think about a better solution in href.js
* fix typos, simplify href, be honest about paddingLeft for \not
* Support more scripts in \text{} environments.
This diff is a follow-up to PR #1060 which added support for Indic scripts.
In order to support Czech, Turkish and Hungarian text (at least) inside
\text{} environments, we need to recognize the Latin Extended A and B
Unicode blocks. The patch also adds support for Georgian, and enhances
support for Cyrillic by defining the entire Cyrillic unicode block instead
of defining symbols for a subset of Cyrillic letters as we did previously.
* Only return fontMetrics for supported Unicode scripts in text mode
The Unicode scripts listed in unicodeScripts.js are supported in text mode
but getCharacterMetrics() was returning fake metrics for them even in
math mode. This caused bad handling of \boldsymbol\imath
* use Mode from types.js
* Create a separate entry point for webpack
Created a webpack entry point for KaTeX, which imports katex.less. As
flow[1] and jest[2] doesn't support CSS modules natively, a separate
entry point is used and it is not flowtyped.
[1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
[2] https://facebook.github.io/jest/docs/en/webpack.html
* Use webpack to build files
* Made webpack.config.js export valid webpack configuration
* Use:
browserify -> webpack
babelify -> babel-loader
UglifyJS CLI -> UglifyJsPlugin
Less CLI -> less-loader
cleancss -> cssnano in css-loader
build/fonts -> file-loader
* Inline CSS(Less) using style-loader and export them using
ExtractTextPlugin
* Add `watch` npm script calling `webpack --watch`
* Improve local testing(webpack-dev-server)
* Made webpackDevServer export a valid webpack configuration
* Compile Less and inline CSS using less-loader and style-loader
* Instead of copying files serve files from /static and use file-loader
* Remove old server.js and its dependencies
* Use webpack-dev-server in Screenshotter
* Include contrib in webpack-dev-server
+ Moved common configurations to webpack.common.js
* Rename webpackDevServer.js to webpack.dev...
to be consistent, avoid confusion with webpack-dev-server and follow
webpack configuration naming convention.
* Remove unnecessary conditional output.path
* Use map instead of reduce
+ Add comments regarding function arguments
* Remove unnecessary mkdir and clean build/* before build
* Use katex as external dependency instead of global variable in contrib
Fixes#692.
* Unblock codes as they are built as a module
* Update package-lock.json
* Add comments regarding devServer option
* Lint renamed webpack.dev.js
a0d8b33
* Export ES6 module and expose its default export
* Revert "Browserify hotfix (#1057)"
This reverts commit f6b509123b.
* Enables colors on the console when running the dev server in Screenshotter
* Add context to webpack configuration
Allows webpack to be run from other directories
* Move `rm -rf build/*` to npm scripts
* Check dependencies before build
* Move UglifyJsPlugin into config creation
* Let webpack handle ES6 modules
Do not transform modules to commonjs in Babel. However Jest doesn't not
support ES6 modules, so transfrom modules to commonjs when NODE_ENV is
`test`.
* Add documentation on testing in IE 9 and 10 using webpack-dev-server
Changed version range to include IE-compatible version
* Add support for \aa, \AA, \lq, \rq, \lbrack, \rbrack
The lack of \aa and \AA was reported in #1066. Added these
via simple macros, with supporting tests. Also add \lq, \rq,
\lbrack, \rbrack as aliases for "`", "'", "[", "]" which were
in the same area of latex.ltx.
* removed duplicate comment
This patch just makes KaTeX recognize Unicode codepoints in the
range \u0900-\u109f so that those South and Southeast Asian scripts
do not get automatically rejected.
The patch also generalizes the way that Unicode blocks are handled
to make it easier to add support for new scripts in the future.
src/unicodeRegexes.js is replaced with the new file src/unicodeScripts.js
* Unicode accents
* Lexer now looks for combining dicritical marks and adds them to the same character
* Parser's `parseSymbol` now recognizes both combined and uncombined forms of Unicode accents, and builds accent objects just like the accent functions
* Added CJK support to math mode (not just text mode)
* Add invalid combining character test
* Add MathML test
* Add weak support for other Latin-1 characters
This maintains backwards compatibility, but it uses the wrong font.
There's a TODO to fix this later.
Also refactor symbol code to use for..of
* Update Unicode screenshot
* Remove dot from accented i and j (in math mode)
Also add dotless Unicode characters to support some accented i's and j's
* Fix \imath, \jmath, \pounds, and more tests
* Switch from for..of to .split().forEach()
Save around 800 bytes in minified code
* Fix split
* normalize() detection
* Convert back to vanilla for loops
* Fix merge
* Move normalize dependency to unicodeMake.js
* Make unicodeSymbols into a lookup table instead of macros
This is important for multi-accented characters.
* Add comments about when to run
* Move symbols definition into unicodeMake/Symbols.js
* Remove CJK support in text mode
* Add missing semicolon
* Refactor unicodeAccents to its own file
* Dotless i/j support in text mode
* Remove excess character mappings
* Fix Åå in math mode (still via Times)
* Update to support #1030
* Add accented Greek letter support (for supported Greek symbols)
* Update screenshot
* remove Æ, æ, Ø, ø, and ß from math mode test
* 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
* 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
* 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.
* 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
* 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
* 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.
* 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
* \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
* 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
* 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
* 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
* 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
* 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.
* 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
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%
}}}
```
This is the fourth in a series of PRs to give KaTeX the ability to recognize Unicode character input.
All the characters in this PR will produce `bin` atoms.