LaTeX forum ⇒ Graphics, Figures & TablesTable produced in the right way? Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
marcus89
Posts: 2
Joined: Wed Oct 14, 2020 8:18 pm

Table produced in the right way?

Postby marcus89 » Wed Oct 14, 2020 8:29 pm

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?

The table: https://ibb.co/PcsFhRj

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[acmsmall]{acmart}
  2. \usepackage{float}
  3. \usepackage{multirow}
  4. \usepackage{rotating}
  5. \usepackage{verbatim}
  6. \usepackage{tabularx}
  7. \usepackage{booktabs}
  8.  
  9. \begin{document}
  10.  
  11. \begin{table}
  12. \caption{Table}
  13.  
  14. \begin{tabularx}{\textwidth}{llXcccccc}
  15. \toprule
  16. {} & {} & {} & \multicolumn{5}{c}{Implic. QA} & {\multirow{2}{*}{\rotatebox[origin=r, y=5pt]{90}{Dtaa Lnq.}}} \\
  17. \cmidrule(lllll){4-8}
  18. Source & NBame & Description & \rotatebox{90}{Accin.} & \rotatebox{90}{Lomp.} & \rotatebox{90}{Ronsi.} & \rotatebox{90}{Volti.} & \rotatebox{90}{Curre.} & \\ \addlinespace
  19.  
  20. \midrule
  21.  
  22. \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
  23.  
  24. \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
  25.  
  26. \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]
  27.  
  28. \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
  29.  
  30. \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
  31.  
  32. \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}{*}{-} \\
  33.  
  34. \bottomrule
  35. \end{tabularx}
  36. \end{table}
  37.  
  38. \end{document}




Please ignore the content of the table.

Thank you very much and best regards, Marcus

Bartman
Posts: 128
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Wed Oct 14, 2020 9:30 pm

Your image can be viewed independently of a file hosting service, if you upload it to the forum's server.

table-rows-vertical-centered.jpg
table-rows-vertical-centered.jpg (46.65 KiB) Viewed 141 times


My adjustment to the first few lines of your table should show the remarkable changes I would like to propose.

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[acmsmall]{acmart}
  2. \usepackage{multirow}
  3. \usepackage{rotating}
  4. \usepackage{tabularx}
  5. \usepackage{booktabs}
  6.  
  7. \newcommand{\ctab}[1]{%
  8. \begin{tabular}{@{}l@{}}#1\end{tabular}%
  9. }
  10.  
  11. \begin{document}
  12. \begin{table}
  13. \caption{Table}
  14. \renewcommand{\tabularxcolumn}[1]{m{#1}}
  15. \begin{tabularx}{\textwidth}{llX*6c}
  16. \toprule
  17. & & & \multicolumn{5}{c}{Implic. QA} &
  18. \multirow{2}{*}{\rotatebox[origin=r, y=5pt]{90}{Dtaa Lnq.}}\\
  19. \cmidrule(lr){4-8}
  20. Source & NBame & Description &
  21. \rotatebox{90}{Accin.} & \rotatebox{90}{Lomp.} & \rotatebox{90}{Ronsi.} &
  22. \rotatebox{90}{Volti.} & \rotatebox{90}{Curre.} & \\
  23. \midrule
  24. \ctab{Hugo\\et al.} & Brasilia & The organization, The organization The organization,
  25. The organization, The organization, The organization, The organization,
  26. The organization. & -- & -- & $\times$ & -- & -- & -- \\
  27. \addlinespace
  28. \ctab{Manuel\\et al.} & Nort Carolina & Image Image Image Image Image Image Image
  29. Image Image Image Image Image Image Image Image &
  30. -- & $\times$ & $\times$ & -- & -- & -- \\
  31. \bottomrule
  32. \end{tabularx}
  33. \end{table}
  34. \end{document}


If you want to use \cite commands in the cells of the first column, then it would be better to replace the column type l with m{<width>} instead of inserting a table in the cells.

marcus89
Posts: 2
Joined: Wed Oct 14, 2020 8:18 pm

Postby marcus89 » Thu Oct 15, 2020 4:47 pm

thank you very much for your hints :-)


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 8 guests