3

I have a long table which spans several pages. For some unknown reasons to me since I have itemized stuff in my table, it cannot break them into pages. Also the spacing between the items are still wider than what I want. Here is what I have got:

\begin{center}
\begin{longtable}{ p{7.5cm} p{4.5cm} p{2cm} }
\renewcommand{\arraystretch}{1.3}
\caption{Here is the caption}
\label{Table:table_label}\\
\hline \hline
\textbf{{\small Title1}} & \textbf{{\small Title2}} & \textbf{{\small Title3}} \\
\hline \hline

\endfirsthead
\multicolumn{3}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline \hline
\textbf{{\small Title1}} & \textbf{{\small Title2}} & \textbf{{\small Title3}} \\
\hline \hline
\endhead
\hline \multicolumn{3}{r}{\textit{Continued on next page}} \\
\endfoot
\hline \hline
\endlastfoot

{\small item1}
\begin{itemize}
\renewcommand{\labelitemi}{\diamond}
    \item {\footnotesize subitem1.1}
    \item {\footnotesize subitem1.2}
    \item {\footnotesize subitem1.3}
    \item {\footnotesize subitem1.4}
         \begin{itemize}
         \renewcommand{\labelitemi}{$\ast$}
             \item {\footnotesize subsubitem1.4.1}
         \end{itemize}
    \end{itemize} & {\small Data1} & \textbf{{\small No1}} \\
\hline
{\small item2} & {\small Data2} & \textbf{{\small No2}} \\
\hline
{\small item3}
\begin{itemize}
\renewcommand{\labelitemi}{$\diamond$}
    \item {\footnotesize subitem3.1}
    \item {\footnotesize subitem3.2}
    \item {\footnotesize subitem3.3}
    \item {\footnotesize subitem3.4}
    \item {\footnotesize subitem3.5}
    \item {\footnotesize subitem3.6}
\end{itemize} & {\small Data3} & \textbf{{\small No3}} \\
\end{longtable}
\end{center}
  • 1
    Welcome to the site! Thanks for providing some code- could you turn it into a complete minimal working example (MWE)? longtable can break a table across pages, but will not break a cell, regardless of its contents (text, itemize, etc); you might like tex.stackexchange.com/questions/54823/page-breaks-in-table-rows – cmhughes Nov 15 '13 at 19:26
  • 1
    longtable only breaks between the rows of the table, a cell never breaks. You need to put each item into a separate row of the table rather than use a list or (better usually) just use a list and don't use longtable. – David Carlisle Nov 15 '13 at 19:59
  • Never use center around longtable – egreg Sep 30 '14 at 20:18
4

9 times out of 10 it's better to set this sort of thing as a list than as a table, which allows a lot more flexibility, and allows page breaking within items, a basic start might be:

enter image description here

\documentclass{article}
\usepackage{longtable}

\renewcommand{\labelitemi}{$\diamond$}
\newcommand\foo[3]{\item[{%
\parbox[t]{\linewidth}{%
\hrule
\vspace{2pt}%
\makebox[.5\linewidth][c]{#1}%
\makebox[.3\linewidth][c]{#2}%
\makebox[.2\linewidth][c]{#3}%
\endgraf
\vspace{2pt}%
\hrule}}]\par\mbox{}}


\begin{document}

\begin{description}
\foo{item1}{Data1}{No1}
\begin{itemize}
    \item  subitem1.1
    \item  subitem1.2
    \item  subitem1.3
    \item  subitem1.4
         \begin{itemize}
             \item subsubitem1.4.1
         \end{itemize}
\end{itemize}

\foo{item2}{Data2}{No2}
\begin{itemize}
    \item subitem3.1
    \item subitem3.2
    \item subitem3.3
    \item subitem3.4
    \item subitem3.5
    \item subitem3.6
\end{itemize}
\end{description}


\end{document}

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.