1

I am using \makecell in table text because I need to make multiple lines text inside the cell. But I can not get the third column cells to be aligned to left. My tabular only centers the last cell. Can you figure our why?

\documentclass[sigconf]{acmart}
\usepackage{booktabs}
\usepackage{array, makecell} 
\begin{document}
\title{Test}

\author{First Author}
\affiliation{%
  \institution{First University}
  \city{City}
  \state{Country}
}

\begin{abstract}
Abstract here.
\end{abstract}
\maketitle
\section{Section}
\begin{table}[!tp]
  \caption{caption here}
  \label{table:simple}
  \centering
  \begin{tabular}{@{\extracolsep{4pt}}lllc@{}}
    \toprule
    Col 1               & Col2                      & Col 3                 & Col 4 \\
    \midrule
    Test here           &  AAA                      & DDDDDDDDD                 &GG     \\
    Test here           &  \makecell{BBB \\ CCC}    & \makecell{EEEEEE \\ FFFFFFF}  &HH     \\ 
  \bottomrule
  \end{tabular}
\end{table}

\end{document}

enter image description here

2

To quote the makecell package documentation:

This macro allows optional alignment settings. \makecell[<vertical or/and horizontal alignment>]{<cell text>} For vertical alignment you use t , b , or c —this letters you usually put in optional argument of tabular or array environments. For horizontal alignment you may use alignment settings like r , l , or c , or more complex, like {p{3cm}}[...]


To left-align contents in a makecell command, you can use the alignment option l as follows: \makecell[l]{EEEEEE \\ FFFFFFF}

Complete example:

\documentclass[sigconf]{acmart}
\usepackage{booktabs}
\usepackage{array, makecell} 
\begin{document}
\title{Test}

\author{First Author}
\affiliation{%
  \institution{First University}
  \city{City}
  \state{Country}
}

\begin{abstract}
Abstract here.
\end{abstract}
\maketitle
\section{Section}
\begin{table}[!tp]
  \caption{caption here}
  \label{table:simple}
  \centering
  \begin{tabular}{@{\extracolsep{4pt}}lllc@{}}
    \toprule
    Col 1               & Col2                      & Col 3                 & Col 4 \\
    \midrule
    Test here           &  AAA                      & DDDDDDDDD                 &GG     \\
    Test here           &  \makecell{BBB \\ CCC}    & \makecell[l]{EEEEEE \\ FFFFFFF}  &HH     \\ 
  \bottomrule
  \end{tabular}
\end{table}

\end{document}

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.