[XeTeX] Making nice tables
Mike Maxwell
maxwell at umiacs.umd.edu
Sat Nov 24 04:45:24 CET 2007
Ross Moore wrote:
> On 22/11/2007, at 4:07 PM, Mike Maxwell wrote:
>> I've found solutions for many of the problems, but tables seem to
>> be a more difficult problem. Some of our tables run longer than a
>> single page, so I have given dblatex a parameter
>> (table.in.float="0") that tells it to use the package 'longtable'.
>> The result is bizarre in certain cases...
>> As you can see, table 3.3 (which is broken
>> across this page and the next) has a very odd bottom line; it
>> extends slightly to the left of the left-hand vertical border, and
>> over half of the right-hand part of the line is missing.
>
> That line is the line drawn above the footnotes.
> It is not connected to the table at all.
You're right (of course)
> The question you should ask is why are the footnotes being placed
> on this page and not floated a bit further along.
I looked into this, and I think it's because the footnotes in question
are "coming from" (referenced from) the previous table, not from the
main text. Apparently the footnote placement algorithm treats footnotes
referenced in tables differently from footnotes referenced in body text
(and inappropriately).
> Alternatively, try \suppressfloats[b] on this page, before
> the apparently bad table, then you may be able to make
> it float to the next page, and perhaps get even more footnotes
> onto this one --- if there are still any left, that is.
I guess I could do that if I were hand-editing Latex text, but in fact
I'm going from DocBook to *tex by an automatic process, and I want to
retain the automatic nature of this process; I don't want to run the
text-to-PDF, look for problems like this, edit the tex, ... if for no
other reason than the fact that if someone else finds a problem that
requires editing the DocBook source, then I would have to repeat all the
hand-edits (or worse, start the debugging process again).
> Alternatively, allow the 2nd table to have only the [t] location,
> and not [h] or [b].
...
> Then try putting in some explicit vertical space;
> e.g. with
> \bigskip\bigskip\bigskip
> or an explicit \vspace{....} .
Just to emphasize the point: I can't afford to hand-edit table locations.
> I think the whole table should float to the next page.
> Is it really a long table? Or just another quite short one,
> like the first one on that page?
It's a short one. The problem is that dblatex gives me only two
choices: tables float, or they don't float but they can extend across
page boundaries (using the 'longtable' package). I *have* to allow the
latter, because some of my tables are longer than a page, so all the
(DocBook formal) tables end up using the longtable package, even if
they're not long tables.
I was hoping that Latex could be smart about this sort of thing, in the
sense that it would try to float short tables, but would allow long
tables to extend beyond a single page. At least the packages that
dblatex knows about don't seem that smart. Maybe some of the other
packages (xtab, supertabular) are smart enough, but they seem to have a
different syntax--I can't just replace every occurrence of 'longtable'
with 'xtabular', for example.
One simple "solution" I tried was to put \clearpage after every
\end{longtable}. That's an easy edit, and one I could do automatically,
as a post-process. It clears up the footnote problem (at least on the
tables I've looked at), but at the cost of not putting two tables on a
page even if they would fit. Since some of the tables are quite short,
this looks rather silly.
What I *really* want is something like "If the next thing to output is a
table (etc.), then if it will fit entirely on the current page, put it
there. If it won't fit on the current page, but it's less than a page
long, then float it on to the next page. (And fill up the current page
with any body text that's coming up, if that won't cause orphans and
widows, etc.) But if the table is more than a page long, then start it
on the current page if there's room for more than a header row and the
first row, else start it on the next page, etc."
I realize that's a bit simplistic, but I do wish *tex would try a bit
harder... Maybe some of the other table packages do? If I can figure
out how to test them out, I will.
Thanks for the ideas.
--
Mike Maxwell
maxwell at umiacs.umd.edu
"For over a thousand years, the British Empire was the guardian
of good grammar and the English language.
Before the dark times. Before the Americans."
--Bob Kenobi (Ben Kenobi's younger brother)
More information about the XeTeX
mailing list