Line breaks for inline formulas (#1287)

* Line breaks for inline formulas

* Basic support for \allowbreak and \nobreak

* Fix spacing around \nobreak, and add documentation

* Backwards-compatibility _getBuilt to fix tests

* Put operator spacing on same line as operator

* One approach to ~

* Simplify \allowbreak/\nobreak, make ~/\nobreakspace prevent line breaks

* Adapt to #1295

* Prevent wrapping within a .base

* Implement \hspace* properly

* Fix flow error

* Update comment for regularSpace

* Update screenshots

* Move `width: min-content` from .katex into .base

* Fix screenshot

* Add min-width rule to .vlist-s

* Factor out hasClass method

* Cleanup nobreak test

* Pull out buildHTMLUnbreakable

* Fix \hspace* test (no longer the same as \hspace)

* Fix \nobreak handling

* Add screenshot test
This commit is contained in:
Erik Demaine
2018-05-10 19:44:26 -04:00
committed by Kevin Barabash
parent 34e6458245
commit 523df299e5
32 changed files with 149 additions and 43 deletions

View File

@@ -144,6 +144,20 @@ LeftRightStyleSizing: |
LimitControls: |
\displaystyle\int\limits_2^3 3x^2\,dx + \sum\nolimits^n_{i=1}i +
\textstyle\int\limits_x^y z
LineBreak: |
\frac{x^2}{y^2} + z^2 =
z^2 + \frac{x^2}{y^2} =
\frac{x^2}{y^2} +\nobreak z^2 =
z^2 + \frac{x^2}{y^2} =
\frac{x^2}{y^2} + ~ z^2 =
z^2 + \frac{x^2}{y^2} =
\frac{x^2}{y^2} + \hspace{1em} z^2 =
z^2 + \frac{x^2}{y^2} =
\frac{x^2}{y^2} + z^2 = \hspace*{1em}
z^2 + \frac{x^2}{y^2} =
\frac{x^2}{y^2} + z^2 =
hi \allowbreak there =
hi \allowbreak there
LowerAccent: |
\begin{matrix}
\underleftarrow{AB} \quad \underrightarrow{AB} \quad \underleftrightarrow{AB} \quad \undergroup{AB} \\