[XeTeX] table indentation

Michiel Kamermans pomax at nihongoresources.com
Sun Nov 22 22:26:10 CET 2009


Hi Ross,
> Yes, this sounds like a decent approach for an automated process. Do 
> you not find, however, that you get some bad page-breaks? e.g. a table 
> overfills a page, or just a single row gets put at the bottom of one 
> page or the top of the next page? Or there is too much space left 
> behind if a table is shifted to the next page? Or it indents incorrectly?
I'm using longtable for tables that have 8 or more lines in them. 
Basically the conversion scripts does two things, namely: 1) check how 
long the table would be and either convert to tabular or longtable, and 
2) if it's too wide to fit on the page with an indent, it'll set up the 
table without indent, and centered. (for tabular that means 0 
tableindent and inside a center environment, for longtable it means left 
and right \fill padding). Getting part (2) to work sucked, to be honest, 
because I couldn't figure out how to tell TeX to check the width of the 
generated table without analysing aux files and writing something in 
pure TeX (which I still find mystifyingly hard), so instead I just wrote 
a table width guestimator based on the fact that I use Palatino Linotype 
as main font, and Kozuka Mincho Pro as CJK font... most of the time. 
Since the conversion of table data is fully deterministic, computing a 
width guess based on the table properties was doable (and determining 
the font metrics for palatino took a bit, but as a job was fairly 
simple). The guestimator won't get the table width exactly right, but 
it's close enough to what TeX ends up with, so it's reliable enough for 
determining whether a table will be too wide in the resulting document.

If the table is then still too wide without indentation, intervention in 
the source material is required, but tables that are still too wide if 
they get the full page width are typically good examples of bad tables, 
so the source would have to be adjusted then anyway.

So tables are pretty good, they don't really lead to awkwardly spaced 
pages - regular text, on the other hand, seems to. There is the 
occasional page that is so curiously vertically spaced that I just go 
"but, what are you doing TeX, you can fit more lines of text on that 
page easily, and I don't see any problems on the next page if you 
relocate some lines from the next page's top paragraph to this one...". 
However, that's not really the tool chain's fault, since the source for 
those pages typically don't even involve tables (it's usually near 
mostly text pags with short 2 or 4 item lists wrapped in the "samepage" 
environments per set of two with lots of text paragraphs around them).

An example of this would be document page 77 (pdf page 91) in 
http://grammar.nihongoresources.com/lib/exe/fetch.php?media=an_introduction_to_japanese_-_syntax_grammar_language.pdf 
- I have no idea why TeX did things that way.. In this case, I don't see 
why it couldn't just move the next page's section heading, as well as 
the entire first paragraph of text following that heading, to the page 
before and space things out a little nicer.

But that said, with the packages used, the chain works pretty well.

- Mike


More information about the XeTeX mailing list