feat: Support \mathstrut (#2416)

* feat: Support \mathstrut

* Update screenshots
This commit is contained in:
Ron Kok
2020-08-12 20:45:33 -07:00
committed by GitHub
parent 981e3ee0eb
commit 26e0a05221
7 changed files with 8 additions and 3 deletions

View File

@@ -659,7 +659,7 @@ use `\ce` instead|
|\mathscr|$\mathscr{AB}$|`\mathscr{AaBb123}`<br>KaTeX supports A-Z|
|\mathsf|$\mathsf{AaBb123}$|`\mathsf{AaBb123}`|
|\mathsterling|$\mathsterling$||
|\mathstrut|<span style="color:firebrick;">Not supported</span>||
|\mathstrut|$\sqrt{\mathstrut a}$|`\sqrt{\mathstrut a}`|
|\mathtip|<span style="color:firebrick;">Not supported</span>||
|\mathtt|$\mathtt{AaBb123}$|`\mathtt{AaBb123}`|
|\matrix|<span style="color:firebrick;">Not supported</span>|See `{matrix}`|

View File

@@ -268,7 +268,7 @@ KaTeX also supports `\llap`, `\rlap`, and `\clap`, but they will take only text,
| `~` | non-breaking space | `\negthinspace` | ³∕₁₈ em space
| `\<space>` | space | `\negmedspace` | ⁴∕₁₈ em space
| `\nobreakspace` | non-breaking space | `\negthickspace` | ⁵∕₁₈ em space
| `\space` | space |
| `\space` | space | `\mathstrut` | `\vphantom{(}`
</div>

View File

@@ -361,6 +361,9 @@ defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
// \mathstrut from the TeXbook, p 360
defineMacro("\\mathstrut", "\\vphantom{(}");
// \not is defined by base/fontmath.ltx via
// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
// It's thus treated like a \mathrel, but defined by a symbol that has zero

View File

@@ -2505,6 +2505,7 @@ describe("A phantom builder", function() {
expect`\phantom{x^2}`.toBuild();
expect`\phantom{x}^2`.toBuild();
expect`\phantom x`.toBuild();
expect `\mathstrut`.toBuild();
expect`\hphantom{x}`.toBuild();
expect`\hphantom{x^2}`.toBuild();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -315,7 +315,8 @@ OverUnderset: |
\end{array}
Phantom: \begin{array}{l}
\dfrac{1+\phantom{x^{\blue{2}}} = x}{1+x^{\blue{2}} = x} \left(\vphantom{\int_t} zzz \right) \left( X \hphantom{\frac{\frac X X}{X}} \right)\\
\text{a \phantom{123}} b \hphantom{\frac{1}{2}}=c \vphantom{101112} d
\text{a \phantom{123}} b \hphantom{\frac{1}{2}}=c \vphantom{101112} d \\
\sqrt{\mathstrut a} + \sqrt{\mathstrut d}
\end{array}
Pmb: \mu\pmb{\mu}\pmb{=}\mu\pmb{+}\mu
PrimeSpacing: f'+f_2'+f^{f'}