Skip to content

Commit

Permalink
fix: \hline after \cr (#3735)
Browse files Browse the repository at this point in the history
Support `\hline` when it occurs after a `\cr` within an environment

Fixes #3734
  • Loading branch information
ronkok committed Oct 22, 2022
1 parent be07984 commit ebf6bf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/environments/array.js
Expand Up @@ -39,6 +39,11 @@ function getHLines(parser: Parser): boolean[] {
const hlineInfo = [];
parser.consumeSpaces();
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") {
parser.consume();
hlineInfo.push(nxt === "\\hdashline");
Expand Down
1 change: 1 addition & 0 deletions test/katex-spec.js
Expand Up @@ -1266,6 +1266,7 @@ describe("A begin/end parser", 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\cr \hline c&d\end{matrix}`.toParse();
expect`\begin{matrix}\hdashline a&b\\ \hdashline c&d\end{matrix}`.toParse();
});

Expand Down

0 comments on commit ebf6bf5

Please sign in to comment.