Render tabular* by its declared column template
This commit is contained in:
1 parent
40abb7bef3
commit
3770de0804
3 files changed
+15
-4
No files matched your search
+13
-2
@@ -2097,7 +2097,7 @@ fn strip_page_geometry(source: &str) -> (String, PageGeometry) {
|
||||
continue;
|
||||
}
|
||||
let mut table_environment = None;
|
||||
for environment in ["tabular", "longtable", "tabularx", "tabularx"] {
|
||||
for environment in ["tabular", "longtable", "tabularx", "tabular*"] {
|
||||
let begin = format!("\\begin{{{environment}}}");
|
||||
if let Some(rest) = trimmed.strip_prefix(&begin) {
|
||||
table_environment = Some((environment, rest));
|
||||
@@ -2113,7 +2113,7 @@ fn strip_page_geometry(source: &str) -> (String, PageGeometry) {
|
||||
Some((_, tail)) => tail.trim_start(),
|
||||
None => rest,
|
||||
};
|
||||
let (rest, target) = if environment == "tabularx" {
|
||||
let (rest, target) = if environment == "tabularx" || environment == "tabular*" {
|
||||
let Some((width, after)) = braced(rest) else {
|
||||
continue;
|
||||
};
|
||||
@@ -10260,6 +10260,7 @@ const SUPPORTED_ENVIRONMENTS: &[&str] = &[
|
||||
"tabular",
|
||||
"longtable",
|
||||
"tabularx",
|
||||
"tabular*",
|
||||
"displaymath",
|
||||
"math",
|
||||
"equation",
|
||||
@@ -12375,6 +12376,16 @@ See \ref{fig:a} and \ref{tab:b}.";
|
||||
assert!(!json.contains("#1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tabular_star_renders_its_table() {
|
||||
let source = "\\begin{tabular*}{200pt}{ll}\na & b \\\\\n\\end{tabular*}";
|
||||
let (_, geometry) = geometry_and_body(source);
|
||||
assert_eq!(geometry.tabular.len(), 1);
|
||||
let json = preview_json(source).expect("preview");
|
||||
assert!(json.contains("\"warnings\":[]"), "warnings: {json}");
|
||||
assert!(!json.contains("tabular*"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn newcolumntype_expands_in_templates() {
|
||||
let source = "\\newcolumntype{L}{>{\\centering}p{20mm}}\n\n\\begin{tabular}{Ll}\nalpha beta & right \\\\\n\\end{tabular}";
|
||||
|
||||
Reference in new issue
Block a user