mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
Nested Math in Non-Default Text Fix (#1111)
* Fixing nested math in non-default text. Added appropriate screenshot tests. * Adding appropriate logic for buildMathML and resolving tests. * Addressing Kevin's comment. Adding tests. * Adding appropriate screenshots. * Removing unnecessary data, adding consistent naming convention. * Cleanup * Handling possible edge cases. * Updating per PR comments
This commit is contained in:
committed by
Kevin Barabash
parent
b341034d2b
commit
7de91f73eb
@@ -88,51 +88,7 @@ exports[`An implicit group parser within optional groups should work with \\colo
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`An implicit group parser within optional groups should work with sizing commands: \\sqrt[\\small 3]{x} 1`] = `
|
||||
[
|
||||
{
|
||||
"type": "sqrt",
|
||||
"mode": "math",
|
||||
"value": {
|
||||
"type": "sqrt",
|
||||
"body": {
|
||||
"type": "ordgroup",
|
||||
"mode": "math",
|
||||
"value": [
|
||||
{
|
||||
"type": "mathord",
|
||||
"mode": "math",
|
||||
"value": "x"
|
||||
}
|
||||
]
|
||||
},
|
||||
"index": {
|
||||
"type": "ordgroup",
|
||||
"mode": "math",
|
||||
"value": [
|
||||
{
|
||||
"type": "sizing",
|
||||
"mode": "math",
|
||||
"value": {
|
||||
"type": "sizing",
|
||||
"size": 5,
|
||||
"value": [
|
||||
{
|
||||
"type": "textord",
|
||||
"mode": "math",
|
||||
"value": "3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`An implicit group parser within optional groups should work wwith old font functions: \\sqrt[\\tt 3]{x} 1`] = `
|
||||
exports[`An implicit group parser within optional groups should work with old font functions: \\sqrt[\\tt 3]{x} 1`] = `
|
||||
[
|
||||
{
|
||||
"type": "sqrt",
|
||||
@@ -179,3 +135,47 @@ exports[`An implicit group parser within optional groups should work wwith old f
|
||||
}
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`An implicit group parser within optional groups should work with sizing commands: \\sqrt[\\small 3]{x} 1`] = `
|
||||
[
|
||||
{
|
||||
"type": "sqrt",
|
||||
"mode": "math",
|
||||
"value": {
|
||||
"type": "sqrt",
|
||||
"body": {
|
||||
"type": "ordgroup",
|
||||
"mode": "math",
|
||||
"value": [
|
||||
{
|
||||
"type": "mathord",
|
||||
"mode": "math",
|
||||
"value": "x"
|
||||
}
|
||||
]
|
||||
},
|
||||
"index": {
|
||||
"type": "ordgroup",
|
||||
"mode": "math",
|
||||
"value": [
|
||||
{
|
||||
"type": "sizing",
|
||||
"mode": "math",
|
||||
"value": {
|
||||
"type": "sizing",
|
||||
"size": 5,
|
||||
"value": [
|
||||
{
|
||||
"type": "textord",
|
||||
"mode": "math",
|
||||
"value": "3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
`;
|
||||
|
@@ -607,7 +607,7 @@ describe("An implicit group parser", function() {
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should work wwith old font functions: \\sqrt[\\tt 3]{x}", () => {
|
||||
it("should work with old font functions: \\sqrt[\\tt 3]{x}", () => {
|
||||
const tree = stripPositions(getParsed("\\sqrt[\\tt 3]{x}"));
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 24 KiB |
@@ -309,7 +309,13 @@ TextStacked:
|
||||
\textsf{\textrm{\textbf{abc123}} \textbf{abc123} \textit{abc123}}\\
|
||||
\textit{abc123 \textbf{abc123} \textsf{abc123}}\\
|
||||
\end{matrix}
|
||||
TextWithMath: \text{for $a < b$ and $ c < d $}.
|
||||
TextWithMath:
|
||||
\begin{matrix}
|
||||
\text{for $a < b$ and $ c < d $}. \\
|
||||
\textsf{for $a < b$ and $ c < d $}. \\
|
||||
\textsf{for $a < b \textbf{ and } c < d $} \\
|
||||
\text{\sf for $a < b$ and $c < d$.}
|
||||
\end{matrix}
|
||||
Unicode: \begin{matrix}\text{ÀàÇçÉéÏïÖöÛû} \\ \text{БГДЖЗЙЛФЦШЫЮЯ} \\ \text{여보세요} \\ \text{私はバナナです} \end{matrix}
|
||||
Units: |
|
||||
\begin{array}{ll}
|
||||
|
Reference in New Issue
Block a user