3

I have a bullet list within a table, but it has unwanted white space above the list, making it horizontally unaligned with other cells in the row. Starting the list with \begin{itemize}[noitemsep,topsep=0pt] helps a bit, but the problem persists. Is there a way to get rid of the space?

Here is my minimal working example consisting of 4 code pattern combinations from the above link:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{enumitem}
\begin{document}
Hello world.

\begin{tabular}{l>{\raggedright}p{3in}}
\toprule
   Item title \#1
   &
   \begin{itemize}[noitemsep,topsep=0pt] % Code pattern 1
   \item Two
   \item bullets
   \end{itemize}
\tabularnewline[0.1in]
   Item title \#2
   &
   \begin{itemize}[noitemsep,topsep=0pt] % Code pattern 1, 2nd row
   \item Two more
   \item bullets
   \end{itemize}
\tabularnewline[0.1in]
   Item title \#3
   &
   \kern-\parskip\begin{itemize}[noitemsep,topsep=0pt] % Code pattern 2
   \item Another two
   \item bullets
   \end{itemize}\kern-\parskip
\tabularnewline[0.1in]
   Item title \#4
   &
   \kern-\parskip\begin{itemize} % Code pattern 3
   \item Another two more
   \item bullets
   \end{itemize}\kern-\parskip
\tabularnewline[0.1in]
   Item title \#5
   &
   \begin{itemize}[noitemsep,topsep=-8pt] % Code pattern 4
   \item Another two more
   \item bullets still
   \end{itemize}
\tabularnewline \bottomrule
\end{tabular}

\end{document}

Here is the compiled result:

enter image description here

2
  • 1
    tex.stackexchange.com/a/580153/134144 could be interesting. – leandriis Mar 10 at 20:10
  • I got lost in all the code for the various effects, but focused on what might be the key bit: tabitemize. I found my way to this page and discovered that \vspace{-1em}\begin{itemize}[noitemsep,topsep=0pt] got rid of the space. Thanks! – user2153235 Mar 10 at 20:23
4

And a simpler table without lists?

mwe

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\newcommand\xxx{\par\hangindent1em\makebox[1em][l]{$\bullet$}}
\begin{tabular}{lp{2in}}\toprule
   Item title \#1 & \xxx Two  \xxx bullets \\\addlinespace
   Item title \#2 & \xxx Two more \xxx bullets \\\addlinespace
   Item title \#3 & \xxx Another two \xxx bullets \\\addlinespace
   Item title \#4 & \xxx Another two more \xxx bullets \\\addlinespace
   Item title \#5 & \xxx Another two more \xxx bullets with a long item taking more than one line.  \\\bottomrule
\end{tabular}
\end{document}
2
  • I have to say, this is one of the most elegant solutions. Minimal code, easy to read. Thanks! – user2153235 Mar 11 at 0:35
  • 1
    +1: I was laughing in my head about the name of the \newcommand :). – Dr. Manuel Kuehner Apr 10 at 21:53
2

Just add

\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{label=\textbullet, 
                     leftmargin=*,
                     nosep, 
                     before=\begin{minipage}[t]{\hsize}\raggedright, 
                     after=\end{minipage}}

to your preamble and use tabitemize instead of itemize. No need for manual adjustments any more:

enter image description here

In the following MWE, I also replaced >{\raggedright} with >{\raggedright\arraybackslash}. With this modified code, you can use the regular \\ instead of tabularnewline.

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{enumitem}

%%% added:
\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{label=\textbullet, 
                     leftmargin=*,
                     nosep, 
                     before=\begin{minipage}[t]{\hsize}\raggedright, 
                     after=\end{minipage}}



\begin{document}

\begin{tabular}{l>{\raggedright\arraybackslash}p{3in}}
\toprule
   Item title \#1
   &
   \begin{tabitemize}
   \item Two
   \item bullets
   \end{tabitemize}\\
   Item title \#2
   &
   \begin{tabitemize}
   \item Two more
   \item bullets
   \end{tabitemize}\\
\bottomrule
\end{tabular}

\end{document}
1
  • Thanks, leandriis. This code makes it clear to me that there's a lot I need to learn about the fundamentals of LaTeX (and enumitem, which is new to me). I tend to hack and slash code patterns without really understanding the details. – user2153235 Mar 11 at 0:39
2

I defined a new list type with the relevant parameters and used a compress command (borrowed from an answer on this site) that makes latex believe lists are at the beginning of a minipage.

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{enumitem}

\makeatletter
\newcommand{\compress}{\@minipagetrue}
\makeatother
\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize,1]{noitemsep, label=\textbullet, topsep=0pt, after=\vspace{-\baselineskip}}

\begin{document}

Hello world.\bigskip

\begin{tabular}{l>{\raggedright\compress}p{3in}}
\toprule
   Item title \#1
   & \begin{tabitemize}
   \item Two
   \item bullets
   \end{tabitemize}
\tabularnewline[0.1in]
   Item title \#2
   & \begin{tabitemize}
   \item Two more
   \item bullets
   \end{tabitemize}
\tabularnewline[0.1in]
   Item title \#3
   & \begin{tabitemize}
   \item Another two
   \item bullets
   \end{tabitemize}
\tabularnewline[0.1in]
   Item title \#4
   & \begin{tabitemize}
   \item Another two more
   \item bullets
   \end{tabitemize}\kern-\parskip
\tabularnewline[0.1in]
   Item title \#5
   & \begin{tabitemize}
   \item Another two more
   \item bullets still
   \end{tabitemize}
\tabularnewline \bottomrule
\end{tabular}

\end{document} 

enter image description here

1
  • Thanks, Bernard. I think this is going to be the source of education on my part...I just need to find the bandwidth to follow-up and delve into it. – user2153235 Mar 11 at 0:46
0

Thanks to leandriss, I found my way to this page and discovered the answer with some experimentation: \vspace{-1em}\begin{itemize}[noitemsep,topsep=0pt].

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{enumitem}
\begin{document}
Hello world.

\begin{tabular}{l>{\raggedright}p{3in}}
\toprule
   Item title \#1
   &
   \vspace{-1em}\begin{itemize}[noitemsep,topsep=0pt] % Code pattern 1
   \item Two
   \item bullets
   \end{itemize}
\tabularnewline[0.1in]
   Item title \#2
   &
   \vspace{-1em}\begin{itemize}[noitemsep,topsep=0pt] % Code pattern 1, 2nd row
   \item Two more
   \item bullets
   \end{itemize}
\vspace{-1em} \tabularnewline \bottomrule
\end{tabular}
\end{document}

Here is the compiled result:

enter image description here

Unfortunately, \vspace{-1em} \tabularnewline \bottomrule doesn't get rid of the space at the bottom, and \tabularnewline \vspace{-1em} \bottomrule generates an error. I can live with that.

2
  • The top lines don't quite line up. \vspace{-1\baselineskip} might be more precise. I don't have any useful suggestions for the excess space below. – barbara beeton Mar 10 at 21:56
  • Thanks, barbara beeton. I found that if I use \tabularnewline instead of tabularnewline[0.1in] after \toprule, there is space at the very top, but it seems balance with the gap at the bottom. Plus, it seems consistent with the gaps between rows. However, this might be a side effect of the organizational template that I'm using. – user2153235 Mar 10 at 22:07

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.