Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I know the table trick of adding "struts" in the first line after and the last line before a \hline. I use it throughout my document, and it looks good that way.

However, now I am working within a longtable / supertabular environment. If a page break is reached, these environments add a running head, which in my case ends with a \hline.

Now I've got a problem. While the longtable / supertabular environment knows where a page break happens, and adds the new header, I don't know that. I cannot add the "above" strut at the appropriate place.

The only option that I see is adding a "below" strut to the head's \hline. But I don't know how to do that...?!?

share|improve this question
add comment

2 Answers

up vote 15 down vote accepted
 \hline
 \noalign{\vskip 3in}    

puts some space after the line.

share|improve this answer
2  
Could you make your answers a bit longer? The software flags them as "low quality posts" for review. :-) –  Martin Schröder Feb 29 '12 at 23:11
9  
I could change the 3in to 4in, if that would help:-) –  David Carlisle Feb 29 '12 at 23:17
    
Similar to the booktabs solution, this breaks vertical lines... –  DevSolar Mar 1 '12 at 8:48
3  
Basically it is the booktabs solution, if you look what booktabs does internally. If you have vertical lines then put a strut with big depth in the row before the line. that extends the rules, then use \noalign{\vskip-3pt}\hline\noalign{\skip3pt} to move the rule back over the extended line. –  David Carlisle Mar 1 '12 at 9:31
    
Nice... but since the only vertical lines in that particular table are on the outside, I already worked around that by replacing those outer lines with a mbframed environment. ;-) –  DevSolar Mar 1 '12 at 15:57
show 3 more comments

The following is not a direct answer to your question but, instead, a suggestion to consider taking a different and (in my view) ultimately much simpler approach to solving your problem.

Like you do now, I also used to place struts above and below various \hline instructions to improve the overall look of a tabular (or tabular*, supertabular, etc.) environment. I think I first started using struts in this fashion after reading an article by Claudio Beccari entitled "Correct spacing for tables and arrays," published in TeX and TUG News, Vol 2, No 3, 1993. (This article is available online; see pp. 10-11 in, e.g., http://mirror.utexas.edu/ctan/info/digests/ttn/ttn2n3.pdf. I think it's still well worth a read.)

Then, just a few years ago, I "discovered" the booktabs package, which takes the opposite approach to solving the problem of obtaining proper spacing around horizontal lines in tables. Instead of changing the depths/heights (by inserting the appropriate struts) of the lines of text immediately before/after an \hline, the package provides the commands \toprule, \bottomrule, \midrule, and \cmidrule: these automatically insert an appropriate amount of vertical whitespace below and/or above the respective horizontal lines. (In addition, these horizontal lines tend to look much more professional because they don't all have the same width, but that's a separate issue.)

Suppose, then, that you need to create an extra-long table that contains three columns, and suppose that you're going to use the xtabular environment -- made available by loading the xtab package -- to create this table. You could then set up something like this:

\tablefirsthead{%  % for table header on first page
\toprule
  Col 1 header & Col 2 header & Col 3 header \\
\midrule
}

\tablehead{%     % for table headers except on first page
\multicolumn{3}{l}{\small\emph{Continued from previous page}} \\
\midrule[\heavyrulewidth]  % line with same width as \toprule but with more spacing
  Col 1 header & Col 2 header & Col 3 header \\
\midrule
}

\tabletail{%    % for table tails except on very last page
\midrule[\heavyrulewidth]  %line with same width as \bottomrule but with more spacing
\multicolumn{3}{r}{\small\emph{Continued on next page}} \\
}

\tablelasttail{\bottomrule}  % table tail on very last page

\tablecaption{A very long table} \label{tab:verylong}
\begin{xtabular}{lcc}
% various lines
\midrule
% various lines
\midrule
% various lines
% ...
\end{xtabular}

What makes this approach, in my view, so appealing is that you've delegated to LaTeX and, in particular, the macros of booktabs package all work related to setting the appropriate vertical whitespace around the various horizontal lines. No need for you (the author) to figure out where to insert struts.

share|improve this answer
1  
That, indeed, seems to be the solution. Unfortunately booktabs breaks vertical lines... (I know they are a "no-no" typographically, but sometimes there are good reasons for using them...) –  DevSolar Mar 1 '12 at 6:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.