diff --git a/crates/texrra-tex-core/src/lib.rs b/crates/texrra-tex-core/src/lib.rs index 2352e9d..ef2f883 100644 --- a/crates/texrra-tex-core/src/lib.rs +++ b/crates/texrra-tex-core/src/lib.rs @@ -678,7 +678,7 @@ impl Halign { let start = rule.start.min(last); let end = rule.end.min(last).max(start); let x = self.column_offset(start) + rule.trim_left; - let right = (self.column_offset(end + 1) - rule.trim_right).min(self.width - self.margin); + let right = self.column_offset(end + 1) - rule.trim_right; (x, (right - x).max(65_536)) } } diff --git a/src/route_d.rs b/src/route_d.rs index 94699d4..0956f49 100755 --- a/src/route_d.rs +++ b/src/route_d.rs @@ -13762,8 +13762,13 @@ fn build_document_with_labels( } if let Some(table) = spec.table { if let Some((template, source, target)) = geometry.tabular.get(table) { - let table_unit = + let mut table_unit = tabular_unit(&geometry, index as u64, template, source, *target); + if let Some(VerticalItem::Halign(halign)) = table_unit.items.first_mut() + && halign.width < width + { + halign.margin += (width - halign.width) / 2; + } content.extend(table_unit.items); } }