[OS X TeX] hyphenation in longtable

Bruno Voisin bvoisin at mac.com
Tue Feb 13 17:56:41 EST 2007


Le 13 févr. 07 à 16:27, Chabot Denis a écrit :

> I prepared a short tex file including extracts from two longtables  
> I have in my document.
>
> [...]
>
> The problem is there are many differences between my 2 tables so it  
> is hard to identify the culprit.

That's a classical problem due to the way tables are constructed in  
LaTeX. It's not connected with \multicolumn.

Tables in LaTeX (i.e. the tabular environment) are constructed by  
setting the space between rows to 0, and inserting a \strutbox in  
each row, where \strutbox is reset by each size-changing command to  
have a height of 0.7 times the normal baselineskip and a depth of 0.3  
times that baselineskip. From latex.ltx:

\def\set at fontsize#1#2#3{%
     [...]
         \setbox\strutbox\hbox{%
           \vrule\@height.7\baselineskip
                 \@depth.3\baselineskip
                 \@width\z@}

When the content of a row has smaller height and depth than the  
\strutbox, this box takes over and sets the space between rows,  
yielding evenly spaced rows.

When, as in your case, row entries are taller or deeper than  
\strutbox, then the space between rows is adjusted to make room for  
these entries. However, any space added by \\[some-space] is added  
with respect to the \strutbox, not with respect to the actual row  
content. Hence, in your case where the row entries are exceedingly  
deep, the 15pt-deep space added to the \strutbox by \\[15pt] is  
buried within these entries.

You can easily check this: because of the p{} column specifiers,  
which creates top-aligned paragraphs, each table element has the same  
height as the \strutbox and an exceedingly large depth. Replace the p 
{} specifiers by b{}, you'll get bottom-aligned paragraphs yielding  
table elements with the same depth as \strutbox and exceedingly large  
height, and suddenly the effect of \\[15pt] will be seen.

Two ways to solve this (while keeping the p{} column specifiers):

- The standard LaTeX way: adjust the \arraystretch parameter, which  
is a multiplicative factor multiplying the interrow space (actually  
it multiplies the height and depth of \strutbox), until that space  
becomes larger than the depth of each table element. I don't like  
this way of proceeding, as you need to proceed by trial-and-error and  
the final result will in no case be a specified fixed space of 15pt  
between the content of the two successive rows.

- The original TeX way: use \noalign, namely replace \\[15pt] by \\ 
\noalign{\vspace{15pt}}. \noalign{} does really what you expected \\ 
[] to do, namely add a fixed space between successive rows, whatever  
the height and depth of each element of the rows and whatever the  
\strutbox.

Hope this helps and is not too convoluted to follow,

Bruno Voisin
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list