mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-11 14:08:42 +00:00
Support for top-level \newline and \\ in inline math (#1298)
* Support for top-level \newline and \\ in inline math This was a little tricky because `\\` was defined as an endOfExpression. Instead made `\\` a termination specific to an array environment. Outside an array environment, buildHTML handles the `cr` object, resulting in a `.newline` class. Currently this turns into a `display: block` (with appropriate vertical spacing) only in inline math, matching LaTeX. * Simplify code * Fix Jest errors * NewLine screenshot test * Bug fix: \\ only works at top level of inline * Add \newline and \cr to test * Switch test to pmatrix * Add vertical space test * Add \\ vs. \newline tests * Fix flow errors * Add \cr test * Add documentation for \\ at top level * Comment out newRow * Fix commenting out
This commit is contained in:
@@ -132,6 +132,13 @@ will appear larger than 1cm in browser units.
|
||||
- MathJax supports Unicode text characters in math mode, unlike LaTeX.
|
||||
To support this behavior in KaTeX, set the `unicodeTextInMathMode` option
|
||||
to `true`.
|
||||
- KaTeX breaks lines with `\\` and `\newline` in inline math, but ignores them
|
||||
in display math (matching LaTeX's behavior, but not MathJax's behavior).
|
||||
To allow `\\` and `\newline` to break lines in display mode,
|
||||
add the following CSS rule:
|
||||
```css
|
||||
.katex-display > .katex > .katex-html > .newline { display: block !important; }
|
||||
```
|
||||
|
||||
## Libraries
|
||||
|
||||
|
Reference in New Issue
Block a user