[XeTeX] shifting tabulars left if too big?

Michiel Kamermans pomax at nihongoresources.com
Mon Oct 5 08:25:42 CEST 2009


Hi all,

does anyone know how to position a tabular block on the page differently 
depending on whether its too wide to fit the page with the default 
tabular indentation in place? I have some tables that do not fit on a 
page if the indent is respected, but fit on the page fine if \noindent 
is used. This is in an automated setting, so I don't have the luxury of 
manually tweaking the TeX, the solution has to "just work" for all 
tables thrown at it...

I was initially considering preprocessing the TeX code before running it 
through XeLaTeX, to detect whether or not a table would be too wide and 
would require \noindent, but that idea died pretty quickly when I 
realised I had no way of telling how wide a table would be, since I 
can't easily tell which fonts are used, and at which fontsize, without 
pretty much writing an entire quasi TeX-processor =P

I stopgapped it at the moment by simply wrapping all tables in a center 
environment with \noident before the tabular; this makes the "fits if 
indent is removed" tables look okay, but makes smaller tables look quite 
silly, so ideally a solution to this problem would involve some kind of 
macro that evaluates how wide a table's been made by the TeX processor, 
and then places the table in a center enviroment with a \noindent before 
the \begin{tabular} command to effect a reasonable looking table if it's 
running over the page's content margin. How impossible is this? =x

Thanks in advance,

- Mike "Pomax" Kamermans
nihongoresources.com


More information about the XeTeX mailing list