mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
fix: \hline after \cr (#3735)
Support `\hline` when it occurs after a `\cr` within an environment Fixes #3734
This commit is contained in:
@@ -39,6 +39,11 @@ function getHLines(parser: Parser): boolean[] {
|
|||||||
const hlineInfo = [];
|
const hlineInfo = [];
|
||||||
parser.consumeSpaces();
|
parser.consumeSpaces();
|
||||||
let nxt = parser.fetch().text;
|
let nxt = parser.fetch().text;
|
||||||
|
if (nxt === "\\relax") { // \relax is an artifact of the \cr macro below
|
||||||
|
parser.consume();
|
||||||
|
parser.consumeSpaces();
|
||||||
|
nxt = parser.fetch().text;
|
||||||
|
}
|
||||||
while (nxt === "\\hline" || nxt === "\\hdashline") {
|
while (nxt === "\\hline" || nxt === "\\hdashline") {
|
||||||
parser.consume();
|
parser.consume();
|
||||||
hlineInfo.push(nxt === "\\hdashline");
|
hlineInfo.push(nxt === "\\hdashline");
|
||||||
|
@@ -1266,6 +1266,7 @@ describe("A begin/end parser", function() {
|
|||||||
|
|
||||||
it("should parse an environment with hlines", function() {
|
it("should parse an environment with hlines", function() {
|
||||||
expect`\begin{matrix}\hline a&b\\ \hline c&d\end{matrix}`.toParse();
|
expect`\begin{matrix}\hline a&b\\ \hline c&d\end{matrix}`.toParse();
|
||||||
|
expect`\begin{matrix}\hline a&b\cr \hline c&d\end{matrix}`.toParse();
|
||||||
expect`\begin{matrix}\hdashline a&b\\ \hdashline c&d\end{matrix}`.toParse();
|
expect`\begin{matrix}\hdashline a&b\\ \hdashline c&d\end{matrix}`.toParse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user