2

I want to use a bullet list in a table. My problem with this is that there is a lot of space to the left and basically half my table is empty.

So I searched for a solution on StackExchange and found one. It introduced the command \tabitem for which \begin{itemize} isn't needed and which doesn't take up as much space to the left (though it still could be less).

\tabitem is defined via:

\newcommand{\tabitem}{~~\llap{\textbullet}~~}

However, it has its own problem: The space to the left isn't the same everywhere. Take a look at this table:

Furthermore, I want a second level of indentation. So I tried using the normal \begin{itemize} and \item because it comes with a lot of space to the left anyways.

\begin{table}
    \begin{tabularx}{\textwidth}{|>{\setlength\hsize{0.33\hsize}\setlength\linewidth{\hsize}}X|>{\setlength\hsize{0.33\hsize}\setlength\linewidth{\hsize}}X|>{\setlength\hsize{0.33\hsize}\setlength\linewidth{\hsize}}X|}
        \hline
        I-Dateneinheiten & S-Dateneinheiten & U-Dateneinheiten \\
        \hline
        \tabitem Datenübertragung
            \begin{itemize}
                \item Bei gesetztem Poll-Bit: Empfänger muss mit Quittung reagieren.
                \item Sequenznummer N(R) quittiert korrekten Empfang aller Dateneinheiten bis N(R)-1.
            \end{itemize}
        &       
        \tabitem Steuerung des Datenflusses
        \begin{itemize}
            \item z.B. Sendeaufruf, Bestätigung empfangener Daten, ...
            \item Kodierung der Befehle bzw. Meldungen durch S-Bits (Supervisory Funktionsbits)
        \end{itemize}
        &

        \tabitem Steuerung der Verbindung
        \begin{itemize}
            \item keine Empfangsfolgenummern
            \item Kodierung durch M-Bits (Modifier Funktionsbits)
        \end{itemize}
        \\
        \hline

    \end{tabularx}
\end{table}

However, as you can see, it doesn't stand out in the center or right column because \tabitem doesn't put its text far enough to the left.

How can this be fixed?

Summary of what I want:

  • Items without wasting space to the left.
  • At least 2 levels of indentation.
  • 1
    Welcome to TeX.SX! The enumitem package and the nosep option to \begin{itemize} might help. – egreg Jun 11 '16 at 22:41
  • @egreg Doesn't work. (code, screenshot) Or I used it wrong. (I of course put \usepackage{enumitem} to the beginning of the file.) – UTF-8 Jun 11 '16 at 23:47
2

Here is a solution based on enumitem: it consists in using the itemize environment with options wide=0pt,leftmargin=*, and defining a tabitemize environment, which neutralises vertical skips, to be used if the contents of the cell has to begin with an itemize environment. Also, I simplified your use of the X columns:

    \documentclass{report}
    \usepackage{booktabs, array, enumitem, ragged2e, tabularx, makecell}
\setcellgapes{4pt}
    \usepackage[showframe]{geometry}
    \newcommand{\tablistcommand}{%
      \leavevmode\par\vspace{-\baselineskip}%
    }

    \newlist{tabitemize}{itemize}{1}
    \setlist[tabitemize]{%
      leftmargin = * ,
      label = \textbullet ,
      nosep ,
      before = \tablistcommand ,
      after = \tablistcommand
    }

    \begin{document}
    \thispagestyle{empty}
    \begin{table}
    \makegapedcells
    \begin{tabularx}{\linewidth}{|*{3}{>{\RaggedRight\arraybackslash}X|}}
        \hline
        I-Dateneinheiten & S-Dateneinheiten & U-Dateneinheiten \\
        \hline
        \begin{tabitemize}%
        \item Datenübertragung
            \begin{itemize}[wide=0pt, leftmargin=0pt]
                \item Bei gesetztem Poll-Bit: Empfänger muss mit Quittung reagieren.
                \item Sequenznummer N(R) quittiert korrekten Empfang aller Dateneinheiten bis N(R)-1.
            \end{itemize}
        \end{tabitemize}
        &
       \begin{tabitemize}%
        \item Steuerung des Datenflusses
        \begin{itemize}[wide=0pt, leftmargin=0pt]
            \item z.B. Sendeaufruf, Bestätigung empfangener Daten, ...
            \item Kodierung der Befehle bzw. Meldungen durch S-Bits (Supervisory Funktionsbits)
        \end{itemize}
        \end{tabitemize}
        &
       \begin{tabitemize}%
        \item Steuerung der Verbindung
        \begin{itemize}[wide=0pt, leftmargin=0pt]
            \item keine Empfangsfolgenummern
            \item Kodierung durch M-Bits (Modifier Funktionsbits)
        \end{itemize}
        \end{tabitemize}
        \\[-4pt]
        \hline

    \end{tabularx}
\end{table}

\end{document}

enter image description here

  • Your code is a bit messed up and I have too little understanding of it to get it right. Can you please fix it? – UTF-8 Jun 12 '16 at 11:06
  • Oh! Sorry, I should have checked every thing displayed fine. Fixed. – Bernard Jun 12 '16 at 11:34
  • Still, why does for example the table end twice? I put this part at the start of my file and this part where the old table used to be. It certainly makes the indentation in the table look good. However, it puts weird lines everywhere. Those lines also appear on all other pages. My document is a report, btw., not an article. – UTF-8 Jun 12 '16 at 14:58
  • The table (and document) ending twice is just an error in copy-pasting. I've fixed that. The weird lines, as you say, is just the showframe option of geometry. I often use it to check tables don't overflow in the margin, but you can safely remove the option. As to the report instead of article class, I've changed that, but note I couldn't guess: you didn't post a full code. – Bernard Jun 12 '16 at 15:38
  • Thank you! :) Of course you couldn't know that the document type I'm using is report. I just thought that maybe using a document type other than article could cause problems. (Posting all of the code would've been a little much and there are graphics included ... copyrighted graphics, to make matters worse ...) – UTF-8 Jun 12 '16 at 17:19

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.