1

\tabitem is defined as

\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}

as mentioned here.

This code

\begin{table}[h]
    \centering
    \begin{tabular}{|l|r|r|r|}
        \hline
        \textbf{Caption} & \textbf{One} & \textbf{Two} & \textbf{Three} \\ \hline\hline
        \textbf{First section} & & & \\ \hline\hline
        \tabitem Row 1 & 1 & 2 & 3 \\ \hline
        \tabitem Row 2 & 4 & 5 & 6 \\ \hline\hline
        \begin{tabular}[c]{@{}l@{}}\textbf{Second section with a very long}\\\textbf{title that needs a line break}\end{tabular} & & & \\ \hline\hline
        \tabitem Row 3 & 7 & 8 & 9 \\ \hline
        \tabitem Row 4 & 10 & 11 & 12 \\ \hline
    \end{tabular}
    \caption{Example table}
\end{table}

produces a table that looks like this:

enter image description here

But I don’t know how to achieve a result like this within the longtable environment. I suppose that the code has to be structured differently because, for example, tabular does not seem to work within this environment.

Nemgathos
  • 545
  • 3
  • 15

1 Answers1

1

Don't worry about clipped page numbers. I just wanted to reduce the paperheight so that you could see that it was behaving like a longtable.

Provided \ltabitem only as an alternate definition for \tabitem. Either should work in any situation.

\documentclass{article}
\usepackage[paperheight=2in]{geometry}
\usepackage{longtable}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\newcommand\ltabitem{\makebox[1.3em][l]{\,$\bullet$}}
\begin{document}
\begin{longtable}{|l|r|r|r|}
        \hline
        \textbf{Caption} & \textbf{One} & \textbf{Two} & \textbf{Three} \\ \hline\hline
        \textbf{First section} & & & \\ \hline\hline
        \ltabitem Row 1 & 1 & 2 & 3 \\ \hline
        \tabitem Row 2 & 4 & 5 & 6 \\ \hline\hline
        \begin{tabular}[c]{@{}l@{}}\textbf{Second section with a very long}\\\textbf{title that needs a line break}\end{tabular} & & & \\ \hline\hline
        \tabitem Row 3 & 7 & 8 & 9 \\ \hline
        \tabitem Row 4 & 10 & 11 & 12 \\ \hline
    \caption{Example table}
\end{longtable}
\end{document}

enter image description here