0

Latex tables in ladscape or portarait format has been widly discussed here. I have almost tried all solutions presented here. However, I still face one issues. I have a table with more than 40 rows (40 is minimum) in it. I have two choices

1) to display whole table vertically on multiple pages or

2) make a landscape and move tables in parts horizontally along multiple pages.

I have tried all solutions such as minipage, longtable (it is suitable for single column articles not double), landscape,sidewaystables, rotatebox,'afterpage' etc. Here is one of the MWE that i have tried

\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage{lipsum}
\usepackage{ltablex}
\begin{document}
\lipsum[1-2]
\begin{table}
 \rotatebox{90}{
\begin{minipage}{\textheight}
 %\begin{table}
 \centering
 \caption{Caption}
 \label{my-label}
 \begin{tabular}{p{4cm}p{3cm}p{3cm}lp{6cm}}
 \textbf{Author}   & \textbf{Type} & \textbf{Artifact} & \textbf{Method}   &   \textbf{Task}                                                                                                                                                            \\
Haiduc et al.     & Extractive               & C+M               &  IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\

Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
 Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
\end{tabular}
\end{minipage}}
\end{table}
\lipsum[3-7]
\end{document}

This is what i get enter image description here Tables with headers on everypage or on first page doesn't matter for me. Any suggestions??? and that also fits on double column articles??

Skipper07
  • 541

1 Answers1

1

There does not seem to be anything special about this table? Just longtable in a landscape environment seems to meet the requirements.

\documentclass[12pt,twocolumn]{article}
\usepackage{lipsum}
\usepackage{pdflscape,longtable,array}
\begin{document}
\lipsum[1-2]

 \onecolumn
 \begin{landscape}
 \begin{longtable}{p{4cm}p{3cm}p{3cm}lp{6cm}}
 \caption{Caption\label{my-label}}\\
 \textbf{Author}   & \textbf{Type} & \textbf{Artifact} & \textbf{Method}   &   \textbf{Task}                                                                                                                                                            \\
Haiduc et al.     & Extractive               & C+M               &  IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\\\

Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
 Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\
Haiduc et al.     & Extractive               & C+M               & IR              & Program Comprehension                                                                                                                                                    \\                                                
\end{longtable}
\end{landscape}
\twocolumn

\lipsum[3-7]
\end{document}
David Carlisle
  • 757,742
  • I have edited my question. Added a picture for better understanding. As I said I have tried all solutions but didn't get what is desireable. And i need a solution for double column article as well. – Skipper07 Nov 10 '15 at 09:15
  • @Skipper07 surely you don't want a table that wide in a single column of a 2-col page? Just put \onecolumn before the table – David Carlisle Nov 10 '15 at 10:59
  • @Skipper07 made it a 2-col example document – David Carlisle Nov 10 '15 at 11:03
  • I get following error when I use LongTable in my article. Longtable is used for one column articles, not two. This solution will work but not a precise one. `! Package longtable Error: longtable not in 1-column mode.' – Skipper07 Nov 10 '15 at 12:20
  • You can use \onecolumn as above to avoid that error, – David Carlisle Nov 10 '15 at 12:21
  • I need a generic solution. This content might be used in a two column journal paper later. – Skipper07 Nov 10 '15 at 12:33
  • the example above is a 2 column paper, the table example you provided would not possibly fit in 1 col so it is set landscape single col then reverts to 2-col, if that is not what you meant then with a narrower table you could use http://tex.stackexchange.com/questions/74591/multi-page-two-column-table-in-a-single-column-document/87957#87957 – David Carlisle Nov 10 '15 at 12:39
  • well to some extent it worked. and i can see all values in a table, spanned to 4 pages. However, there are still alignment issues and the Caption causing erriors. I have checked the link you shared but seems my case is slightly different. – Skipper07 Nov 10 '15 at 14:36