0

I'm trying to create a table that has different column widths. This is what I have so far.

\usepackage{graphicx} %to scale table

\usepackage{tabularx,ragged2e}
\newcolumntype{C}{>{\Centering\arraybackslash}X} % centered "X" column

\usepackage{lscape}
\newcolumntype{b}{>{\hsize=2.3\hsize}X}
\newcolumntype{s}{>{\hsize=.3\hsize}X}
\newcolumntype{m}{>{\hsize=.9\hsize}X}

\begin{table}[!ht]
\setlength\extrarowheight{2pt} % for a bit of visual "breathing space"
\begin{tabularx}{\linewidth}{|s| s| b|}
\hline
\textbf{Score} & \textbf{ Description } & \textbf{Assessment criteria}  \\\hline
1 & Description 1 & Really long description that is longer than 3 lines  \\
\hline
2 &  Description 2 & Really long description that is longer than 3 lines    \\
\hline
3 & Description 3  &  Really long description that is longer than 3 lines\\
\hline
4 & Description 4 &  Really long description that is longer than 3 lines \\
\hline
5 &  Description 5 &Really long description that is longer than 3 lines \\
\hline
\end{tabularx}
\caption{Criteria used}
\end{table}

This is the result I get: Result

How can I remove the extra column on the right side and make the column description wider to fit with its column? I tried changing the values for width of column but it is not working and I get the same result.

Edit: I'm using the ACM latex template, i.e the acmart document class.

Edit 2: I get this image after using the suggestions of @David Calisle and @daleif

enter image description here

13
  • 1
    your values add up to 3.5 but they must add up to 3 if you have 3 X, but I think you want the first to columns to be set natural width so use llX Mar 30, 2021 at 11:32
  • Please make your example compilable. Does this example even produce the image shown and without compilation errors.
    – daleif
    Mar 30, 2021 at 11:32
  • My example is for a latex template that uses two columns. I'm sorry, I should have included that.
    – user42
    Mar 30, 2021 at 11:37
  • @DavidCarlisle, I'm using the ACM latex template which has two columns on a page. Can you please explain what you mean by 11X?
    – user42
    Mar 30, 2021 at 11:39
  • @daleif, my example is compilable..that's how I got the image.
    – user42
    Mar 30, 2021 at 11:41

1 Answer 1

1

I would write your table on the following way:

\documentclass[twocolumn]{article}
\usepackage{ragged2e}
\usepackage{tabularx}
\newcolumntype{L}{>{\RaggedRight\hspace{0pt}}X} 

\usepackage{lipsum}

\begin{document}
    \begin{table}[ht]
    \setlength\extrarowheight{2pt} % for a bit of visual "breathing space"
    \setlength\tabcolsep{3pt}
\begin{tabularx}{\linewidth}{|c|l|L|}
\hline
\textbf{Score} & \textbf{Description } & \textbf{Assessment criteria}  \\\hline
1 & Description 1 & Really long description that is longer than 3 lines  \\
\hline
2 &  Description 2 & Really long description that is longer than 3 lines    \\
\hline
3 & Description 3  &  Really long description that is longer than 3 lines\\
\hline
4 & Description 4 &  Really long description that is longer than 3 lines \\
\hline
5 &  Description 5 &Really long description that is longer than 3 lines \\
\hline
\end{tabularx}
\caption{Criteria used}
    \end{table}
\lipsum[1]
\end{document}}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .