1

I'm trying to break a long landscape table across many pages without breaking the row. I saw that we should use longtable and landscape packages but it is not working. The code is:

\documentclass[11pt]{article} 
\usepackage{standalone}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[paper=a4paper, left=3.0cm, right=3.0cm, top=1cm, bottom=1cm]{geometry}
\usepackage{ccaption}
\usepackage{array}
\usepackage{caption}
\usepackage[caption=false]{subfig}
\usepackage{tipa}
\usepackage{ctable}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{lipsum}

\begin{document}
        \begin{landscape}
            \begin{table}
                \scriptsize
                \centering
                \newcommand{\otoprule}{\midrule[0.08em]}
                \caption{caption name}
                \label{tab:tabsone}
                % *{15}{p{1cm}}
                \begin{longtable}{@{}p{0.7cm}p{1cm}p{1.5cm}p{2cm}p{1cm}p{0.7cm}p{1.3cm}p{1.3cm}p{1.5cm}p{1.5cm}p{1.3cm}p{1.5cm}p{2cm}p{1.6cm}p{1.9cm}@{}}
                    \toprule
                    Study & Cancer & Conditions & Cell Subtype/ Treatment & Patients & Cell Line    & Technique & RNAseq Library & Sequencing Platform & Microarray & Array Platform & Dataset Ids & Publication Citation & Comments & Criteria study inclusion\\ \otoprule
                    A2.2.2 & hsjsjjsj & \lipsum[66] & \lipsum[66] & jsjsjsjs & jsjsjsj & \lipsum[66] & \lipsum[66] & \lipsum[66] & & & \lipsum[66] & \lipsum[66] & \lipsum[66] \\ \midrule
                    O2.h.13 & hshshshs & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & & & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] \\ \midrule
                    \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \\ \midrule
                    N5.10.2.OP & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & & & \lipsum[66] & \lipsum[66] \\ \bottomrule
                \end{longtable}
            \end{table}
    \end{landscape}
\end{document}

enter image description here

3
  • Welcome to TeX.SE!
    – Mensch
    Nov 10, 2021 at 18:17
  • @TeX.SE thank you :)
    – salamandra
    Nov 10, 2021 at 18:21
  • 1
    Remove the table environment around your \longtable. table prevents the page break here.
    – leandriis
    Nov 10, 2021 at 18:27

1 Answer 1

2

Contents of a table envrionment can't be broken across pages. Hence, remove the table environment and move your \caption command to inside of longtable. (Don't forget the \\ after the \aption or the \label, though). For repeated column headers, use \endhead and \endfirsthead.

Here is a corrected version of your code. Note though that the table still overflows into the margin on page 2 and 3. This is because page breaks can only happen between table rows not within them. Since your table columns are quite narrow and contain comparably much text, a single table row is taller than the available space. Hopefully the contents of your actual table are shorter.

\documentclass[11pt]{article} 
\usepackage[paper=a4paper, left=3.0cm, right=3.0cm, top=1cm, bottom=1cm]{geometry}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{lipsum}

\begin{document}
        \begin{landscape}
                \scriptsize
                \newcommand{\otoprule}{\midrule[0.08em]}
                % *{15}{p{1cm}}
                \begin{longtable}{@{}p{0.7cm}p{1cm}p{1.5cm}p{2cm}p{1cm}p{0.7cm}p{1.3cm}p{1.3cm}p{1.5cm}p{1.5cm}p{1.3cm}p{1.5cm}p{2cm}p{1.6cm}p{1.9cm}@{}}    
                \caption{caption name}             
                \label{tab:tabsone}\\
                    \toprule
                    Study & Cancer & Conditions & Cell Subtype/ Treatment & Patients & Cell Line    & Technique & RNAseq Library & Sequencing Platform & Microarray & Array Platform & Dataset Ids & Publication Citation & Comments & Criteria study inclusion\\ \otoprule \endfirsthead
                 \caption{caption name -- continued from previous page}\\
                    \toprule
                    Study & Cancer & Conditions & Cell Subtype/ Treatment & Patients & Cell Line    & Technique & RNAseq Library & Sequencing Platform & Microarray & Array Platform & Dataset Ids & Publication Citation & Comments & Criteria study inclusion\\ \otoprule \endhead           
                    A2.2.2 & hsjsjjsj & \lipsum[66] & \lipsum[66] & jsjsjsjs & jsjsjsj & \lipsum[66] & \lipsum[66] & \lipsum[66] & & & \lipsum[66] & \lipsum[66] & \lipsum[66] \\ \midrule
                    O2.h.13 & hshshshs & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & & & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] \\ \midrule
                    \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \\ \midrule
                    N5.10.2.OP & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & \lipsum[66] & & & \lipsum[66] & \lipsum[66] \\ \bottomrule
                \end{longtable}
    \end{landscape}
\end{document}
1
  • thank you. it solved the problem
    – salamandra
    Nov 11, 2021 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .