1

I have a table with tabu. I have two questions:

  • how do I make tabu break the table when the page is over and start on the next page?
  • how do I fix the size of the columns? The first should be short, the second a bit broader and the last should fit the rest of the columnwidth.

Minimal working example:

\documentclass{article}
\usepackage{tabu}
\usepackage{blindtext}
\begin{document}
\begin{table}[H]
    \centering
    \resizebox{\textwidth}{!}{\begin{minipage}{\textwidth}
            \caption{Minibeispiel}
            \[\tabulinesep=10pt
            \begin{tabu} to \textwidth {XXX}
            \hline
            Short & Long & Explanation\\
            \hline
            SMS & Small Message Service & \blindtext[10]\\
            DPD & Data Package Data & \begin{itemize}
            \item Please
            \item Help
            \item Me
            \end{itemize}
            \hline
            \end{tabu}
            \]
    \end{minipage}}
\end{table}
\end{document}
4
  • 3
    If you put a tabular in two boxes (resizebox and minipage) and additionally in a table environment nothing will ever be able to break. Beside this: before continuing to use tabu read the readme here github.com/tabu-issues-for-future-maintainer/tabu Sep 12, 2019 at 13:32
  • 1
    I'd suggest to use longtable of xltabular instead of tabu.
    – leandriis
    Sep 12, 2019 at 13:33
  • Will the contents of the first and second column also contain linebreaks?
    – leandriis
    Sep 12, 2019 at 13:35
  • Welcome to TeX.SX! You seem to be asking two questions, here. On TeX.SX, we try to keep questions on separate pages. If you have multiple questions, you should ask each in a separate TeX.SX "question". You'll stand a better chance of getting a satisfactory answer to each of your questions. Sep 12, 2019 at 13:41

1 Answer 1

3

Please see if one of the following examples suits your needs:

In all of the following example, I have used xltabular instead of tabu. In order to enable pagebreaks within the table, I have removed \begin{table}[H], \resizebox{\textwidth}{!}, \begin{minipage}{\textwidth} and \[ around the original table. I have also used \endhead in order to repeat the column headers on the second and (following) pages.

In the first example, I have used two l type columns for the first two columns:

enter image description here

In the second example, I have used an l type column for the first and a fixed width p type column for the second column:

enter image description here

In the last example, I have rotated thetable to landscape orientation. This can be useful and save space if the text in the third column is especially long:

enter image description here

\documentclass{article}
\usepackage{xltabular}
\usepackage{lipsum}
\usepackage{booktabs}

\usepackage{pdflscape}
\begin{document}
            \begin{xltabular}{\linewidth}{llX}
            \caption{Minibeispiel}\\
            \toprule
            Short & Long & Explanation\\
            \midrule
            \endfirsthead
            \toprule
            Short & Long & Explanation\\
            \midrule
            \endhead
            \bottomrule
            \endfoot
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            DPD & Data Package Data & \begin{itemize}
            \item Please
            \item Help
            \item Me
            \end{itemize}\\
            \end{xltabular}

\newpage

            \begin{xltabular}{\linewidth}{l>{\raggedright\arraybackslash}p{1.5cm}X}
            \caption{Minibeispiel}\\
            \toprule
            Short & Long & Explanation\\
            \midrule
            \endfirsthead
            \toprule
            Short & Long & Explanation\\
            \midrule
            \endhead
            \bottomrule
            \endfoot
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            DPD & Data Package Data & \begin{itemize}
            \item Please
            \item Help
            \item Me
            \end{itemize}\\
            \end{xltabular}

\begin{landscape}
            \begin{xltabular}{\linewidth}{l>{\raggedright\arraybackslash}p{1.5cm}X}
            \caption{Minibeispiel}\\
            \toprule
            Short & Long & Explanation\\
            \midrule
            \endfirsthead
            \toprule
            Short & Long & Explanation\\
            \midrule
            \endhead
            \bottomrule
            \endfoot
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            SMS & Small Message Service & \lipsum[4]\\
            DPD & Data Package Data & \begin{itemize}
            \item Please
            \item Help
            \item Me
            \end{itemize}\\
            \end{xltabular}
\end{landscape}
\end{document}

You must log in to answer this question.

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