2

After reading through tutorials, documentations and posts, I tried to design a table on my own. The final result looks exactly as it should be :-)

However, I am not sure if I did it the right way. In my opinion, the code looks quite confusing.

So my question, is there a better/more elegant way to design this table?

\documentclass[acmsmall]{acmart}
\usepackage{float}
\usepackage{multirow} 
\usepackage{rotating} 
\usepackage{verbatim} 
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\begin{table} \caption{Table}

\begin{tabularx}{\textwidth}{llXcccccc} \toprule {} & {} & {} & \multicolumn{5}{c}{Implic. QA} & {\multirow{2}{*}{\rotatebox[origin=r, y=5pt]{90}{Dtaa Lnq.}}} \ \cmidrule(lllll){4-8} Source & NBame & Description & \rotatebox{90}{Accin.} & \rotatebox{90}{Lomp.} & \rotatebox{90}{Ronsi.} & \rotatebox{90}{Volti.} & \rotatebox{90}{Curre.} & \ \addlinespace

\midrule

 \multirow{4}{*}{\shortstack[l]{Hugo \\ et al.}} & \multirow{4}{*}{Brasilia} & The organization, The organization The organization, The organization, The organization, The organization, The organization, The organization. & \multirow{4}{*}{-}  & \multirow{4}{*}{-} & \multirow{4}{*}{x} & \multirow{4}{*}{-} & \multirow{4}{*}{-} & \multirow{4}{*}{-} \\ \addlinespace

 \multirow{3}{*}{\shortstack[l]{Manuel \\et al.}} & \multirow{3}{*}{Nort Carolina} & Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image & \multirow{3}{*}{-}  & \multirow{3}{*}{x} & \multirow{3}{*}{x} & \multirow{3}{*}{-} & \multirow{3}{*}{-} & \multirow{3}{*}{-} \\ \addlinespace

 \multirow{2}{*}{\shortstack[l]{Otto \\ et al.}} & \multirow{2}{*}{Manchester} & Image Image Image Image Image Image Image Image & \multirow{2}{*}{-}  & \multirow{2}{*}{-} & \multirow{2}{*}{-} & \multirow{2}{*}{-} & \multirow{2}{*}{-} & \multirow{2}{*}{-} \\ \addlinespace%[20pt]

 \multirow{2}{*}{\shortstack[l]{Marx \\\& Weak}} & \multirow{2}{*}{France} & Image Image Image Image Image Image Image Image & \multirow{2}{*}{x}  & \multirow{2}{*}{x} & \multirow{2}{*}{-} & \multirow{2}{*}{-} & \multirow{2}{*}{x} & \multirow{2}{*}{x} \\ \addlinespace

 \multirow{2}{*}{\shortstack[l]{Oliver \\\& Wolfor}} & \multirow{2}{*}{Germany} & Image Image Image Image Image Image Image Image & \multirow{2}{*}{-}  & \multirow{2}{*}{-} & \multirow{2}{*}{-} & \multirow{2}{*}{x} & \multirow{2}{*}{-} & \multirow{2}{*}{x} \\ \addlinespace

 \multirow{3}{*}{\shortstack[l]{Humbold \\et al.}} & \multirow{3}{*}{Hunbary} & Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image & \multirow{3}{*}{-}  & \multirow{3}{*}{-} & \multirow{3}{*}{-} & \multirow{3}{*}{x} & \multirow{3}{*}{-} & \multirow{3}{*}{-} \\ 

\bottomrule \end{tabularx} \end{table}

\end{document}

enter image description here

Please ignore the content of the table.

Thank you very much and best regards, Harald

  • Welcome to TeX.SE. – Mico Oct 14 '20 at 17:33
  • This is a good first question. For future questions, it would help us if you could include everything we would need to compile. In this case, that would be \documentclass{article} \usepackage{multirow,rotating,tabularx,booktabs} like in the answers. – Teepeemm Oct 14 '20 at 18:49
  • Thank you for the warm welcome. I thought I had provided all these infos in the code? – Harald Foidl Oct 14 '20 at 20:35

2 Answers2

3

The folllwing simplified version of the table code should result in a similar output.

enter image description here

\documentclass[acmsmall]{acmart}
\usepackage{float}
\usepackage{multirow} 
\usepackage{rotating} 
\usepackage{verbatim} 
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\begin{table} \caption{Table} \renewcommand{\tabularxcolumn}[1]{m{#1}} \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}m{1.25cm}lXcccccc} \toprule {} & {} & {} & \multicolumn{5}{c}{Implic. QA} & {\multirow{2}{*}{\rotatebox[origin=r, y=5pt]{90}{Dtaa Lnq.}}} \ \cmidrule(lr){4-8} Source & NBame & Description & \rotatebox{90}{Accin.} & \rotatebox{90}{Lomp.} & \rotatebox{90}{Ronsi.} & \rotatebox{90}{Volti.} & \rotatebox{90}{Curre.} & \ \addlinespace

\midrule

 Hugo et al. 
   & Brasilia 
     & The organization, The organization The organization, The organization, The organization, The organization, The organization, The organization. 
       & -  & - & x & - & - & - \\ \addlinespace

 Manuel et al. 
   & Nort Carolina 
     & Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image 
       & - & x & x & - & - & - \\ \addlinespace

 Otto et al. 
   & Manchester 
     & Image Image Image Image Image Image Image Image 
       & - & - & - & - & - & - \\ \addlinespace%[20pt]

 Marx \& Weak 
   & France 
     & Image Image Image Image Image Image Image Image 
       & x  & x & - & - & x & x \\ \addlinespace

 Oliver \& Wolfor 
   & Germany 
     & Image Image Image Image Image Image Image Image 
       & - & - & - & x & - & x \\ \addlinespace

 Humbold et al. 
   & Hunbary 
     & Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image 
       & - & - & - & x & - & - \\ 

\bottomrule \end{tabularx} \end{table}

\end{document}

leandriis
  • 62,593
  • Heh. Almost the same changes as mine. – Sergei Golovan Oct 14 '20 at 18:30
  • thank you! what is \arraybackslash actually doing? – Harald Foidl Oct 15 '20 at 14:45
  • add1 how can I make the space between all columns equal?

    add2: how can I make the space between, e.g. 'Oliver' and '& Wolfor' smaller?

    – Harald Foidl Oct 15 '20 at 15:27
  • @HaraldFoidl: The horizontal spaces between columns should already be equal. Could you explicitly point out, which distances appear to be uneven. Maybe I'm overlooking something? Does "the space between, e.g. 'Oliver' and '& Wolfor' " refer to the vertical distance between the two lines? Chenging the spacing there would result in the two lines no longer being in line with the contents of the third column, yo I wouldn't recommend doing that. Regarding the use of \arraybackslash: Alan Munn explained it better than I could in their answer. – leandriis Oct 16 '20 at 20:34
2

Everything is fine, but there are way too many unnecessary \multirows. You actually don't need any in the table body. The problem might be that the X column vertically aligns to the top and not to the middle by default. The documentation for tabularx gives an idea on how to change that.

My suggestion of how to improve the code a bit:

\documentclass[acmsmall]{acmart}
\usepackage{float}
\usepackage{multirow} 
\usepackage{rotating} 
\usepackage{verbatim} 
\usepackage{tabularx}
\usepackage{booktabs}

\renewcommand{\tabularxcolumn}[1]{m{#1}}

\begin{document}

\begin{table} \caption{Table}

\begin{tabularx}{\textwidth}{m{1.3cm}lXcccccc} \toprule {} & {} & {} & \multicolumn{5}{c}{Implic. QA} & {\multirow{2}{*}{\rotatebox[origin=r, y=5pt]{90}{Dtaa Lnq.}}} \ \cmidrule(lllll){4-8} Source & NBame & Description & \rotatebox{90}{Accin.} & \rotatebox{90}{Lomp.} & \rotatebox{90}{Ronsi.} & \rotatebox{90}{Volti.} & \rotatebox{90}{Curre.} & \ \addlinespace \midrule Hugo et al. & Brasilia & The organization, The organization The organization, The organization, The organization, The organization, The organization, The organization. & - & - & x & - & - & - \ \addlinespace Manuel et al. & Nort Carolina & Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image & - & x & x & - & - & - \ \addlinespace Otto\break et al. & Manchester & Image Image Image Image Image Image Image Image & - & - & - & - & - & - \ \addlinespace%[20pt] Marx\break & Weak & France & Image Image Image Image Image Image Image Image & x & x & - & - & x & x \ \addlinespace Oliver\break & Wolfor & Germany & Image Image Image Image Image Image Image Image & - & - & - & x & - & x \ \addlinespace Humbold et al. & Hunbary & Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image & - & - & - & x & - & - \ \bottomrule \end{tabularx} \end{table}

\end{document}

enter image description here

  • thank you! One question regarding \renewcommand: does this affect all further tables in the document? I ask because it is not embedded in the table environment of this actual table. – Harald Foidl Oct 15 '20 at 14:46
  • \renewcommand makes all X columns vertically centered. If it's the only one table where centering required, then it's better to redefine \tabularxcolumn locally. – Sergei Golovan Oct 15 '20 at 15:42
  • locally mean within the table environment? Thank you very much! – Harald Foidl Oct 15 '20 at 17:22