1

I need help with automatically moving rows from one cell of the table to the other page. I need a solution for automatic text transfer from one long cell to next page. The solution may seem strange because I have a problem with only a large cell that does not fit on one page. I used tabular package, if we used long-table package then whole row goes to next page instead of particular long cell. Now,it goes down over footer and truncate reaming part, you can check with following MWE.

\documentclass{article}
\usepackage{lipsum}%

\begin{document}

\begin{table}[]
\centering
\caption{Caption}\label{tab2}
\begin{tabular}{|p{5cm}|p{4cm}|}
\hline
text & \lipsum  \\ \hline
\end{tabular}
\end{table}

\end{document}

enter image description here

We need solution, that will help to break cell and reaming part will go to next page.

  • 2
    You probably have to rethink what you are doing. Latex never breaks a table cell across a page break only between rows. – daleif Oct 16 '19 at 6:52
  • Could you please add more backgound information on why you would need such a table with only one huge row that is longter than a page? Probably some kind of list-like environment is more appropriate for your purpose? – leandriis Oct 16 '19 at 7:02
  • No, I don't think so. I required similar table as like above with header and footer which will be carry forward on each page. So list will not be appropriate for my purpose – Anant Sabale Oct 16 '19 at 7:10
  • Actually, want a table like structure for my problem statement in which 1st row will be of header and next row will contain dynamic size of summary data which can be so huge that it may go on new page. Also, manual rowbreak is not controllable in this case. – Anant Sabale Oct 16 '19 at 7:14
  • If this had been easy to implement, breakable rows had been implemented in longtable long time ago. You may split a row at page boundary the using a calstable from the package cals, but not automatically. – Sveinung Oct 16 '19 at 11:48
3

Maybe paracol can help you. You may also use Heiko Oberdiek’s pdfcolparcolumns, if you need stable colours. The caption can be typeset with a \captionof from the caption package (which I assume you already use). For horizontal rule at the start of the environment, you can use

\rule{\dimexpr(2\columnwidth+\columnsep+\columnseprule)}{0.4pt}

before the first parallel column. To set the last horizontal rule (at the end) you first have to back up to the left margin before typesetting the rule. I have have use a negative \hspace to do that:

\hspace{-\dimexpr(\columnwidth+\columnsep+\columnseprule)}
\rule{\dimexpr(2\columnwidth+\columnsep+\columnseprule)}{0.4pt}

I have not found a solution for vertical rules at to the left of the first column and to the right of the second column. However, they are unnecessary, so you may left them out.

enter image description here

\documentclass{article}
\usepackage{paracol, lipsum, caption}
\captionsetup[table]{position=above}


\begin{document}


\captionof{table}{Caption}
\begin{paracol}{2}

\setlength\columnseprule{0.4pt}
\setlength\columnsep{1em}

\rule{\dimexpr(2\columnwidth+\columnsep+\columnseprule)}{0.4pt}

\begin{leftcolumn*}
Test
\end{leftcolumn*}

\begin{rightcolumn}
\lipsum[1]
\end{rightcolumn}

\begin{leftcolumn*}
More test
\end{leftcolumn*}

\begin{rightcolumn}
\lipsum[2-3]
\end{rightcolumn}

\end{paracol}

\end{document}
  • Thanks a lot..Not exactly what I want, but still it will defiantly help me...!!!! – Anant Sabale Oct 17 '19 at 9:17

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.