I don't think that's possible with longtable, or any other tabular environment for that matter, because the material inside the tabular cells are TeX boxes, which by definition cannot be broken.
I suggest you use parcolumns
instead, which has been designed to typeset several columns next to each other for multilingual texts. Here's an example:
\documentclass{article}
\usepackage{lipsum} % Used to produce long text
\usepackage{parcolumns}
\parindent=0pt
\begin{document}
\begin{parcolumns}[colwidths={2=0.74\textwidth},rulebetween,sloppy]{2}
\colchunk[1]{\textbf{ID}}
\colchunk[2]{\texttt{UC\_01\_01}}
\colplacechunks
\colchunk[1]{\textbf{Name}}
\colchunk[2]{Password recovery}
\colplacechunks
\colchunk[1]{\textbf{\textit{Macro}-UC}}
\colchunk[2]{Registration (\texttt{UC\_01})}
\colplacechunks
\colchunk[1]{\textbf{Actors}}
\colchunk[2]{\texttt{ACTOR\_02}}
\colplacechunks
\colchunk[1]{\textbf{Preconditions}}
\colchunk[2]{\lipsum[2-4]}
\colplacechunks
\colchunk[1]{\textbf{Main flow}}
\colchunk[2]{Some itemize list here!}
\colplacechunks
\colchunk[1]{\textbf{Postconditions}}
\colchunk[2]{\lipsum[5-9]}
\colplacechunks
\end{parcolumns}
\end{document}
The underlying problem is that revtex4-1
loads the ltxgrid
package, which makes a number of changes to the latex kernel. In particular, the handling of multicolumn material is changed. The latex commands \onecolumn
and twocolumn
are replaced by \onecolumngrid
and \twocolumngrid
. In addition, ltxgrid
modifies the longtable
macro.
The widetext
environment of revtex4-1
packages the switch from two columns to one column so that single column material can be placed into an environment which begins and ends with leaders (or adornments). The adornments are intended to guide the reader across the column breaks. This environment is mainly aimed at wide equations or passages of text that need visual emphasis, but you can also put a table into it.
You can also just use onecolumngrid
and twocolumngrid
directly, which may be preferred if you don't want the adornments around the table.
First, I'll illustrate with your MWE and widetext
. Then, I'll show a solution using longtable
to continue the headers and footers across page breaks, without the adornments.
\documentclass[aip, amsmath, amssymb, reprint]{revtex4-1}%
\usepackage{xtab,afterpage}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\afterpage{\begin{widetext} %<===
\begin{xtabular*}{\textwidth}{l@{\extracolsep{\fill}}lllll}
\hline\hline\hline
\multicolumn{6}{c}{\textbf{Heading for a lengthy table}}\\
\hline
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
\hline\hline\hline
\end{xtabular*}
\end{widetext} %<===
}
\lipsum[6-14] % more filler text
\end{document}
The widetext
environment adds the adornments automatically; and, because they are set as leaders, they will drop out at page breaks. So, we see an adornment at the end of this table and not at the starting page break.

For the longtable
case, I'll switch to using \onecolumngrid
and \twocolumngrid
. We want longtable
to reach the full width of the page, so we again include @{\extracolsep{\fill}}
. Ordinary, we would also use
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
to remove the default \fill
on either side of the table (see longtable
documentation, page 7). However, ltxgrid
has rewritten part of the macro, overriding these manual selections. Instead, we can define another alignment option for longtable
, analogous to the [c], [l], and [r] that are already defined. I'll call this option [e] (i.e., we have extracolsep):
\def\LT@LR@e{\LTleft\z@ \LTright\z@}%
(I had thought that I would also need to use xpatch
as follows, but it seems unnecessary in this case:
\xpatchcmd{\LT@array@longtable}{\if l#1\LTleft\z@ \LTright\fill}{\if e#1\LTleft\z@ \LTright\z@ \else\if l#1\LTleft\z@ \LTright\fill}{}{}
I'm not sure why this patch isn't also needed).
Putting all this together, we have the following code:
\documentclass[aip, amsmath, amssymb, reprint]{revtex4-1}%
\usepackage{xtab,afterpage,longtable}
\usepackage{lipsum}
\makeatletter
\def\LT@LR@e{\LTleft\z@ \LTright\z@}%
\makeatother
\begin{document}
\lipsum[1-5]
\afterpage{\onecolumngrid
\renewcommand{\doublerulesep}{0pt}
\begin{longtable}[e]{@{\extracolsep{\fill}}llllll}
\hline\hline\hline
\multicolumn{6}{c}{\textbf{Heading for a table}}\\
\hline
\endfirsthead
\hline\hline\hline
\multicolumn{6}{c}{\textbf{Heading for a table}}\\
\hline
\endhead
\hline\hline
\multicolumn{6}{c}{\textit{Con't next page\ldots}}\\
\endfoot
\hline\hline
\endlastfoot
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
col1 & col2 & col3 & col4 & col5 & col6 \\
\end{longtable}
\twocolumngrid
}
\lipsum[6-14] % more filler text
\end{document}

Finally, it may be of interest that this particular table will fit into a two column format (under ltxgrid
) with longtable
if you comment out \onecolumngrid
and \twocolumngrid
.
Best Answer
Here's an attempt that comes close to what you want using the
mdframed
package. Becausemdframed
conceives of its frames as single units, I don't know if it's possible to vary the thickness of just the top and bottom lines. Also, since I've used (or abused) the frame title by putting it outside the frame, there's no simple way to get lines to separate the headings. From the sample document you gave it looks like the format is pretty fixed, so I wrapped each part in either a command or an environment.