4

I have a long multi-page, two-columns wide table in a LaTex document for a journal in twocolumn mode (with 'continued' remarks on captions in subsequent pages). The only way to write this kind a table is to use xtab package. However, the result is several table segments overlapped each other. How can I fix this error?

Note: I don't want a one-column wide table in two-column document.

Page Next page

\documentclass[twocolumn]{article} % in real case: {svjour3}          % twocolumn
\usepackage{xtab, lipsum, array}

\begin{document}

\section{Introduction}
\label{intro}
\lipsum*[2]

\subsection{Subsection}
\label{sec:1.1}
\lipsum*[2]

\topcaption{The caption} \label{tab:1}
\tablefirsthead{
    \hline
    \textbf{Column1} & \textbf{Column2} \\
    \hline}
\tablehead{
    \multicolumn{2}{@{}l}{\em Table \ref{tab:1}, cont'd\strut}\\
    \hline
    \textbf{Column1} & \textbf{Column2} \\
    \hline}
\tabletail{\hline}
\tablelasttail{\hline}
\begin{xtabular}[b]{@{}p{0.2\textwidth}@{\hspace{0.01\textwidth}}p{0.79\textwidth}}
1st Row First Column  & \lipsum*[2]\\
2nd Row Second Column & \lipsum*[2]\\ 
3rd Row Third Column  & \lipsum*[2]\\
4th Row Fourth Column & \lipsum*[2]\\
5th Row Fourth Column & \lipsum*[2]\\
6th Row Fourth Column & \lipsum*[2]\\
7th Row Fourth Column & \lipsum*[2]\\
8th Row Fourth Column & \lipsum*[2]\\
9th Row Fourth Column & \lipsum*[2]\\
10th Row Fourth Column & \lipsum*[2]\\
11th Row Fourth Column & \lipsum*[2]\\
12th Row Fourth Column & \lipsum*[2]\\
13th Row Fourth Column & \lipsum*[2]\\
14th Row Fourth Column & \lipsum*[2]\\
\end{xtabular}

\lipsum*[2]

\lipsum*[2]

\lipsum*[2]

\lipsum*[2]

\end{document}
  • 2
    Welcome to TeX.SE! Your table width is \textwidth, i.e. its width is equal two columnwidth + \columnsep, consequently happen your problem. Try to replace \textwidth with \columnwidth. For more help, please provide small but complete document, which we can copy to our computers and compile. Instead real text you can use dummy text from package lipsum. – Zarko Oct 14 '16 at 20:55
  • 1
    Aside: There's no need, or point, in wrapping the various \textbf{...} directives in an extra pair of curly braces. – Mico Oct 14 '16 at 21:20
  • @Zarko I changed the question having MVE and dummy text. Thanks – Gürol Canbek Oct 15 '16 at 10:18
  • 2
    But you forgot to add packages which macros are used in your code. Please fix this. Now your MWE is not possible to compile. – Zarko Oct 15 '16 at 10:39
  • Now, it is compiled @Zarko – Gürol Canbek Oct 17 '16 at 10:23
4

You actually expect to change page layout somewhere on middle of the text. Simple and rude solution is to add \onecolumn before your table and on the its end add \twocolumn. However, this cause start of new layouts on the new pages. Consequently empty space before and after table can be quite large (till to whole page).

For solution of your problem it cross my mind the following possibilities:

  • set your table as separated document and than include it (for example in appendix) with help of pdfpages package.
  • shrink table to column width and redesign it to one column and contents of the first column as row before content of the second column
  • use description instead of table

As illustration of use \onecolumn/\twocolumn solution and use of description as possible solution please test the following MWE:

\documentclass[twocolumn]{article} % in real case: {svjour3} twocolumn
\usepackage{xtab,lipsum,array,ragged2e}

\begin{document}

\section{Introduction}
\label{intro}
\lipsum[1-5]

\begin{description}\RaggedRight
\item[1st Row First Column]~\\   \lipsum*[2]
\item[2nd Row Second Column]    \lipsum*[2]
\item[3rd Row Third Column]     \lipsum*[2]
\item[4th Row Fourth Column]    \lipsum*[2]
\item[5th Row Fourth Column]    \lipsum*[2]
\item[6th Row Fourth Column]    \lipsum*[2]
\item[7th Row Fourth Column]    \lipsum*[2]
\item[8th Row Fourth Column]    \lipsum*[2]
\end{description}

\section{Section}
\label{sec:1}
\lipsum*[1]

\subsection{Subsection}
\label{sec:1.1}
\lipsum*[2]

\onecolumn
\topcaption{The caption} \label{tab:1}
\tablefirsthead{
    \hline
    \textbf{Column1} & \textbf{Column2} \\
    \hline}
\tablehead{
    \multicolumn{2}{@{}l}{\em Table \ref{tab:1}, cont'd\strut}\\
    \hline
    \textbf{Column1} & \textbf{Column2} \\
    \hline}
\tabletail{\hline}
\tablelasttail{\hline}
\begin{xtabular}[b]{@{}p{0.2\textwidth}@{\hspace{0.01\textwidth}}p{0.79\textwidth}}
1st Row First Column  & \lipsum*[2]\\
2nd Row Second Column & \lipsum*[2]\\
3rd Row Third Column  & \lipsum*[2]\\
4th Row Fourth Column & \lipsum*[2]\\
5th Row Fourth Column & \lipsum*[2]\\
6th Row Fourth Column & \lipsum*[2]\\
7th Row Fourth Column & \lipsum*[2]\\
8th Row Fourth Column & \lipsum*[2]\\
\end{xtabular}
\twocolumn

\end{document}
  • The table solution -unfortunately- seems hard to implement considering the layout concerns that you specified. Just one note for desription, if the item text in square braces are long, it overflows the column boundary (try \item[2nd Row Second Column 2nd Row Second Column 2nd Row Second Column 2nd Row Second Column] \lipsum*[2] instead of \item[2nd Row Second Column] \lipsum*[2]). Therefore, I have to use simple itemize between \footnotesize and \normalsize. – Gürol Canbek Oct 17 '16 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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