0

So I have a table that includes lists written with tabularx, however the lists have rather excess padding at the top and on the left. Is there a way to reduce this only for the space of this table?

Code:

% PRO CON TABLE FOR DIFFERENT TOOLKITS
\begin{table}[h]
\centering
\begin{tabularx}{\textwidth}{|c|X|X|}
\hline
\textbf{Name} & \textbf{Advantages} & \textbf{Disadvantages} \\
\hline
QuTiP &
\begin{itemize}
\item Supervisor is one of the lead developers on the project, so can ask questions and get advice as needed.
\item Widely used, with 371 citations at time of writing, meaning tool may have more value
\end{itemize} & 
\begin{itemize}
\item Con
\item Con
\end{itemize}
\\
\hline
(... other lines ...)
\end{tabularx}%
\end{table}

Example of table with excess cell padding

0
0

With the help of the enumitem package I have created a new itemize-like environment for the use in table cells:

enter image description here

\documentclass{article}
\usepackage{tabularx}
\usepackage{enumitem}

\newlist{tabitemize}{itemize}{1}

\setlist[tabitemize]{nosep,
                  topsep= 0pt,
                  partopsep=0pt,
                  leftmargin= *,
                  label=\textbullet,
                  before=\vspace{-0.6\baselineskip},
                  after=\vspace{-\baselineskip}
                  }

\begin{document}

% PRO CON TABLE FOR DIFFERENT TOOLKITS
\begin{table}[h]
\centering
\begin{tabularx}{\textwidth}{|c|X|X|}
\hline
\textbf{Name} & \textbf{Advantages} & \textbf{Disadvantages} \\
\hline
QuTiP &
\begin{tabitemize}
\item Supervisor is one of the lead developers on the project, so can ask questions and get advice as needed.
\item Widely used, with 371 citations at time of writing, meaning tool may have more value
\end{tabitemize} & 
\begin{tabitemize}
\item Con
\item Con
\end{tabitemize}
\\
\hline
(... other lines ...)
\end{tabularx}%
\end{table}

\end{document}
1
  • That is absolutely fantastic, thank you! Upvoted but won't display as I'm new, but accepted. – Harry Adams Apr 20 '19 at 19:43
0

Another solution, using enumitem and a macro found on this site:

\documentclass{article}
\usepackage{tabularx}
\usepackage{enumitem}

    \makeatletter
    \newcommand*{\compress}{\@minipagetrue}
    \makeatother

\begin{document}%, after=\vspace*{-5\topsep}

% PRO CON TABLE FOR DIFFERENT TOOLKITS
\begin{table}[h]
\centering\sffamily\setlength{\extrarowheight}{4pt}
\setlist[itemize]{wide=0pt, topsep=0pt, leftmargin=*, after ={\vspace*{\dimexpr-\baselineskip + \partopsep}}}
\begin{tabularx}{\textwidth}{|c|*{2}{>{\compress}X|}}
\hline
\textbf{Name} & \textbf{Advantages} & \textbf{Disadvantages} \\ \hline
QuTiP &
\begin{itemize}
\item Supervisor is one of the lead developers on the project, so can ask questions and get advice as needed.
\item Widely used, with 371 citations at time of writing, meaning tool may have more value
\end{itemize} &
\begin{itemize}
\item Con
\item Con
\end{itemize}
\\\hline
(... other lines ...)
\end{tabularx}%
\end{table}

\end{document} 

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.