Fix \\ and \newline after operator (#1796)

* Fix \\ and \newline after operator

Fix #1790.  `\\` and `\newline` render as a span with classes
`mspace` and `newline`.  We need to check for `newline` when bringing
spaces into the same `base` group.

* Add tests and comment
This commit is contained in:
Erik Demaine
2018-12-26 18:17:30 -05:00
committed by Kevin Barabash
parent 1a7ce6cf15
commit 8346294bf3
3 changed files with 124 additions and 2 deletions

View File

@@ -858,6 +858,118 @@ exports[`Extending katex by new fonts and symbols Add new font class to new exte
`;
exports[`Newlines via \\\\ and \\newline \\\\ causes newline, even after mrel and mop 1`] = `
<span class="katex">
<span class="katex-mathml">
<math>
<semantics>
<mrow>
<mi>
M
</mi>
<mo>
=
</mo>
<mspace linebreak="newline">
</mspace>
<mi>
a
</mi>
<mo>
+
</mo>
<mspace linebreak="newline">
</mspace>
<mi>
b
</mi>
<mspace linebreak="newline">
</mspace>
<mi>
c
</mi>
</mrow>
<annotation encoding="application/x-tex">
M = \\\\ a + \\\\ b \\\\ c
</annotation>
</semantics>
</math>
</span>
<span class="katex-html"
aria-hidden="true"
>
<span class="base">
<span class="strut"
style="height:0.68333em;vertical-align:0em;"
>
</span>
<span class="mord mathdefault"
style="margin-right:0.10903em;"
>
M
</span>
<span class="mspace"
style="margin-right:0.2777777777777778em;"
>
</span>
<span class="mrel">
=
</span>
<span class="mspace"
style="margin-right:0.2777777777777778em;"
>
</span>
</span>
<span class="mspace newline">
</span>
<span class="base">
<span class="strut"
style="height:0.66666em;vertical-align:-0.08333em;"
>
</span>
<span class="mord mathdefault">
a
</span>
<span class="mspace"
style="margin-right:0.2222222222222222em;"
>
</span>
<span class="mbin">
+
</span>
<span class="mspace"
style="margin-right:0.2222222222222222em;"
>
</span>
</span>
<span class="mspace newline">
</span>
<span class="base">
<span class="strut"
style="height:0.69444em;vertical-align:0em;"
>
</span>
<span class="mord mathdefault">
b
</span>
</span>
<span class="mspace newline">
</span>
<span class="base">
<span class="strut"
style="height:0.43056em;vertical-align:0em;"
>
</span>
<span class="mord mathdefault">
c
</span>
</span>
</span>
</span>
`;
exports[`href and url commands should not affect spacing around 1`] = `
[
{