3

I am using the following code to generate a table.

\documentclass[acmsmall]{acmart}
\begin{document}
\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{Some text}
\centering
\begin{tabular}{|p{8.3cm}|p{1.7cm}|p{1.7cm}|}
\hline
\textbf{Some text} & \textbf{Some text} & \textbf{Some text} \\
\hline

\textbf{Some text:}
\begin{itemize}
\item Some text
\item Some text
\item Some text
\end{itemize}
& 
43\%{$\newline$}
\checkmark{$\newline$}
-{$\newline$}
-{$\newline$}
& 
57\%{$\newline$}
-{$\newline$}
\checkmark{$\newline$}
\checkmark{$\newline$}
\\
\hline
\textbf{Some text}
\begin{itemize}
\item Some text
\item Some text
\item Some text
\item Some text
\end{itemize}
&
25\%{$\newline$}
\checkmark{$\newline$}
-{$\newline$}
-{$\newline$}
-{$\newline$}
&
75\%{$\newline$}
-{$\newline$}
\checkmark{$\newline$}
\checkmark{$\newline$}
\checkmark{$\newline$}
\\
\hline
\textbf{Some text:}
\begin{itemize}
\item Some text
\item Some text
\end{itemize}
&
0\%{$\newline$}
-{$\newline$}
-{$\newline$}
&
100\%{$\newline$}
\checkmark{$\newline$}
\checkmark{$\newline$}
\\
\hline
\end{tabular}
\label{table1}
\end{table}
\end{document}

However, as shown in the figure below there are empty spaces (highlighted in yellow). I am just wondering if there is a way to remove those extra lines from the table? enter image description here

I am happy to provide any other details if needed :)

6
  • Can you please provide us with a compilable document? When I compile your table with preamble \documentclass[12pt]{article} \usepackage{amssymb} I do not get such large spaces,
    – user121799
    Jan 17, 2019 at 5:05
  • @marmot I am using the following document class \documentclass[acmsmall]{acmart}
    – EmJ
    Jan 17, 2019 at 5:27
  • Please add this (as well as \begin{document} and \end{document}) to your above code such that people have a complete example to play with.
    – user121799
    Jan 17, 2019 at 5:29
  • @marmot Sure, I will add those details. By the way I am getting the same output in the following documentclasses as well; \documentclass[smallextended]{svjour3} and \documentclass[jou,apacite]{apa6}
    – EmJ
    Jan 17, 2019 at 5:33
  • OK, thanks! I have another question (not that I could immediately answer it). Do you want the check marks and - be vertically aligned, i.e. at the same height, as the bullets of itemize? You might want to use e.g. this answer instead of itemize, this would also solve the vertical space problem.
    – user121799
    Jan 17, 2019 at 5:36

2 Answers 2

4

Put \vspace*{-\baselineskip} after each itemize and remove the last {$\newline$} of each column.

\documentclass[acmsmall]{acmart}
\begin{document}
\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{Some text}
\centering
\begin{tabular}{|p{8.3cm}|p{1.7cm}|p{1.7cm}|}
\hline
\textbf{Some text} & \textbf{Some text} & \textbf{Some text} \\
\hline

\textbf{Some text:}
\begin{itemize}
\item Some text
\item Some text
\item Some text
\end{itemize}
\vspace*{-\baselineskip}
& 
43\%{$\newline$}
\checkmark{$\newline$}
-{$\newline$}
-
& 
57\%{$\newline$}
-{$\newline$}
\checkmark{$\newline$}
\checkmark
\\
\hline
\textbf{Some text}
\begin{itemize}
\item Some text
\item Some text
\item Some text
\item Some text
\end{itemize}
\vspace*{-\baselineskip}
&
25\%{$\newline$}
\checkmark{$\newline$}
-{$\newline$}
-{$\newline$}
-
&
75\%{$\newline$}
-{$\newline$}
\checkmark{$\newline$}
\checkmark{$\newline$}
\checkmark
\\
\hline
\textbf{Some text:}
\begin{itemize}
\item Some text
\item Some text
\end{itemize}
\vspace*{-\baselineskip}
&
0\%{$\newline$}
-{$\newline$}
-
&
100\%{$\newline$}
\checkmark{$\newline$}
\checkmark
\\
\hline
\end{tabular}
\label{table1}
\end{table}
\end{document}

enter image description here


Here is a proposal how to format this table in a bit more appealing manner.

\documentclass[acmsmall]{acmart}
\usepackage{booktabs}
\begin{document}
\begin{table}[!t]
  \caption{Some text}
  \centering
  \begin{tabular}{@{}lcc@{}}
    \toprule
    \textbf{Some text}  & \textbf{Some text} & \textbf{Some text} \\
    \midrule
    \textbf{Some text:} & 43\%               & 57\%               \\
    Some text           & \checkmark         & ---                \\
    Some text           & ---                & \checkmark         \\
    Some text           & ---                & \checkmark         \\
    \addlinespace
    \textbf{Some text}  & 25\%               & 75\%               \\
    Some text           & \checkmark         & ---                \\
    Some text           & ---                & \checkmark         \\
    Some text           & ---                & \checkmark         \\
    Some text           & ---                & \checkmark         \\
    \addlinespace
    \textbf{Some text:} & 0\%                & 100\%              \\
    Some text           & ---                & \checkmark         \\
    Some text           & ---                & \checkmark         \\
    \bottomrule
  \end{tabular}
  \label{table1}
\end{table}
\end{document}

enter image description here

1
  • Note that I had to put \vspace*{-\baselineskip} after the last \item in each itemize for this to work.
    – ostrokach
    May 11, 2021 at 20:25
5

Two suggestions:

  • Encase each itemize environment in a top-aligned minipage environment

  • omit the final {$\newline$} directive in each group

Optional: remove the instruction \renewcommand{\arraystretch}{1.3} and add \setlength\extrarowheight{2pt}.

enter image description here

\documentclass[acmsmall]{acmart}
\usepackage{array}
%\usepackage{enumitem}
%\setlist[itemize]{nosep}
\begin{document}
\begin{table}[!t]
%\renewcommand{\arraystretch}{1.3}
\setlength\extrarowheight{2pt}
\caption{Some text}
\label{table1}

\centering
\begin{tabular}{|p{8.3cm}|p{1.7cm}|p{1.7cm}|}
\hline
\textbf{Some text} & \textbf{Some text} & \textbf{Some text} 
\\ \hline

%% 1st group
\textbf{Some text:} & 43\% & 57\% \\ 
\begin{minipage}[t]{\hsize}
\begin{itemize}
\item Some text
\item Some text
\item Some text
\end{itemize}
\end{minipage}
& 
\checkmark{$\newline$}
--{$\newline$}
--%{$\newline$}
& 
--{$\newline$}
\checkmark{$\newline$}
\checkmark%{$\newline$}
\\ \hline

%% 2nd group
\textbf{Some text} & 25\% & 75\%\\
\begin{minipage}[t]{\hsize}
\begin{itemize}
\item Some text
\item Some text
\item Some text
\item Some text
\end{itemize}
\end{minipage}
&
\checkmark{$\newline$}
--{$\newline$}
--{$\newline$}
--%{$\newline$}
&
--{$\newline$}
\checkmark{$\newline$}
\checkmark{$\newline$}
\checkmark%{$\newline$}
\\ \hline

%% 3rd group
\textbf{Some text:} & 0\% & 100\% \\
\begin{minipage}[t]{\hsize}
\begin{itemize}
\item Some text
\item Some text
\end{itemize}
\end{minipage}
&
--{$\newline$}
--%{$\newline$}
&
\checkmark{$\newline$}
\checkmark%{$\newline$}
\\ \hline
\end{tabular}
\end{table}
\end{document}
1
  • 1
    Nice answer. I really like it. Thank you. :)
    – EmJ
    Jan 17, 2019 at 6:21

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