Separate table columns by twice tabcolsep
This commit is contained in:
1 parent
d89b71bfbc
commit
8e274a252d
3 files changed
+11
-11
No files matched your search
+9
-8
@@ -2548,7 +2548,7 @@ fn expand_tabular_template(template: &str, source: &str, target: Option<i64>) ->
|
||||
0,
|
||||
&engine_template(&probe_template),
|
||||
source,
|
||||
6,
|
||||
12,
|
||||
Vec::new(),
|
||||
);
|
||||
let Some(VerticalItem::Halign(halign)) = probe.items.first() else {
|
||||
@@ -2603,7 +2603,7 @@ fn expand_tabular_template(template: &str, source: &str, target: Option<i64>) ->
|
||||
.filter(|(_, expand)| !**expand)
|
||||
.map(|(width, _)| *width)
|
||||
.sum();
|
||||
let share = ((target - fixed - gaps * 6 * SCALE) / x_count as i64).max(SCALE);
|
||||
let share = ((target - fixed - gaps * 12 * SCALE) / x_count as i64).max(SCALE);
|
||||
let share = format!("p{{{:.4}pt}}", share as f64 / SCALE as f64);
|
||||
let mut out = String::new();
|
||||
let mut index = 0;
|
||||
@@ -2657,7 +2657,7 @@ fn tabular_unit(
|
||||
id,
|
||||
&engine_template(&template),
|
||||
source,
|
||||
6,
|
||||
12,
|
||||
Vec::new(),
|
||||
);
|
||||
let separator = geometry.tab_col_sep.unwrap_or(6 * SCALE);
|
||||
@@ -2666,8 +2666,9 @@ fn tabular_unit(
|
||||
if let Some(VerticalItem::Halign(halign)) = unit.items.first_mut() {
|
||||
if separator != 6 * SCALE {
|
||||
let gaps = halign.column_widths.len().saturating_sub(1);
|
||||
halign.column_skips = vec![separator; gaps];
|
||||
halign.width = halign.column_widths.iter().sum::<i64>() + separator * gaps as i64;
|
||||
halign.column_skips = vec![separator * 2; gaps];
|
||||
halign.width =
|
||||
halign.column_widths.iter().sum::<i64>() + separator * 2 * gaps as i64;
|
||||
}
|
||||
if stretch != 1000 {
|
||||
halign.line_height = halign.line_height.saturating_mul(stretch) / 1000;
|
||||
@@ -9658,9 +9659,9 @@ mod tests {
|
||||
_ => None,
|
||||
})
|
||||
.expect("tabular halign");
|
||||
assert_eq!(halign.column_skips, vec![20 * SCALE]);
|
||||
assert_eq!(halign.column_skips, vec![40 * SCALE]);
|
||||
let columns: i64 = halign.column_widths.iter().sum();
|
||||
assert_eq!(halign.width, columns + 20 * SCALE);
|
||||
assert_eq!(halign.width, columns + 40 * SCALE);
|
||||
|
||||
let (_, default) = geometry_and_body("\\begin{tabular}{ll}\nA & B\n\\end{tabular}");
|
||||
assert_eq!(default.tab_col_sep, None);
|
||||
@@ -9678,7 +9679,7 @@ mod tests {
|
||||
.expect("tabular halign");
|
||||
assert!(halign.column_skips.is_empty());
|
||||
let columns: i64 = halign.column_widths.iter().sum();
|
||||
assert_eq!(halign.width, columns + 6 * SCALE);
|
||||
assert_eq!(halign.width, columns + 12 * SCALE);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user