Lay out matrix and array environments as grids

This commit is contained in:
gloamxun committed 2026-10-26 00:39:28 +08:00
1 parent 971190df26
commit 59b6ca571b
6 files changed
+283 -62

No files matched your search

+17
View File
@@ -6424,6 +6424,13 @@ const SUPPORTED_ENVIRONMENTS: &[&str] = &[
"align",
"gather",
"cases",
"matrix",
"pmatrix",
"bmatrix",
"Bmatrix",
"vmatrix",
"Vmatrix",
"array",
"thebibliography",
"theorem",
"lemma",
@@ -7191,6 +7198,16 @@ mod source_tests {
assert_eq!(geometry_counter(&geometry, "steps"), 4);
}
#[test]
fn matrix_environments_paint_their_delimiters() {
let json = preview_json("\\[\\begin{bmatrix} a & b \\\\ c & d \\end{bmatrix}\\]")
.expect("matrix preview");
assert!(json.contains(">[</text>"), "{json}");
assert!(json.contains(">]</text>"), "{json}");
assert!(json.contains(">a</text>"), "{json}");
assert!(!json.contains("unsupported environment"), "{json}");
}
#[test]
fn cases_environments_paint_rows_and_a_brace() {
let json = preview_json("\\[\\begin{cases} x & x>0 \\\\ 0 & \\text{else} \\end{cases}\\]")