1

At the moment, I effectively have one large table containing what should be multiple smaller tables. That is, my formatting needs improvement. Either way, I currently have one table with 9 columns, 3 rows. The 9 columns are split into 3 column sections. What I want is for the gap between each of those 3 column sections to adjust so the width of all tables (or the single large table depending how you look at it) is equal to the page width. Currently they are all together at the center.

This is what I have currently:

\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\noindent\begin{tabular}{lllllllll}
%\toprule
\multicolumn{3}{c}{\textbf{Computer Language}} & \multicolumn{3}{c}{\textbf{Tools}} & \multicolumn{3}{c}{\textbf{Hardware}} \\
\cmidrule(r){1-3}\cmidrule(l){4-6}\cmidrule(l){7-9}
%\midrule
C \& C++ & Java & Python & item & item & item & item & item & item\\
MIPS Assembly & Bash & Verilog & something & item & item & item & item & item \\
%\bottomrule
\end{tabular}
\end{document}

Additionally, is it possible to add bullets to each item as well in this format? Perhaps a different layout entirely would be better suited. Suggestions are welcome.

My explanation may be a bit convoluted so if further explanation is necessary, let me know.

  • 1
    Please use a complete MWE that contains the \documentclass, all the \usepackages (and libraries if you use tikz or something like that), as well as the \begin{document} and \end{document}. Please refer to this and to this – Vinccool96 Mar 20 at 16:04
  • 1
    What exactly does 'adjacent tables' refer to? Currently, your code only contains one tabular environment. – leandriis Mar 20 at 16:06
  • @Vinccool96 Fixed. – hotelmariofan Mar 20 at 16:08
  • @leandriis That's correct, 'adjacent tables' refers more to the three 'sections' of this single table, i.e. Computer Languages, Tools, and Hardware. – hotelmariofan Mar 20 at 16:10
  • @hotelmariofan: I see. Thanks for the clarification. – leandriis Mar 20 at 16:16
1

Here is a possible solution where I split up the table into three tabular environments:

\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs}
\begin{document}
\noindent\begin{tabular}{lll}
\multicolumn{3}{c}{\textbf{Computer Language}}\\
\midrule
C \& C++ & Java & Python \\
MIPS Assembly & Bash & Verilog\\
\end{tabular} \qquad
\begin{tabular}{lll}
\multicolumn{3}{c}{\textbf{Tools}}\\
\midrule
item & item & item \\
item & item & item \\
\end{tabular} \qquad
\begin{tabular}{lll}
\multicolumn{3}{c}{\textbf{Hardware}}\\
\midrule
item & item & item \\
item & item & item \\
\end{tabular}
\end{document}

If you reeplace \qquad with \hfill the distance is automatically adjusted to be as large as possible while still fitting inot one page. The result is shown in the following image (red lines indicate the margin):

enter image description here

  • Aha, this is exactly what I was going for. Thank you! – hotelmariofan Mar 20 at 16:39
2

Something like this, based on tabularx and geometry??

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{ragged2e}
\usepackage{siunitx}
\usepackage{tabularx, booktabs}
\setlength{\extrarowheight}{3pt}
\newcolumntype{Y}{>{\hsize=0.98\hsize\RaggedRight \arraybackslash}X}
\newcolumntype{Z}{>{\hsize=0.98\hsize\RaggedRight \arraybackslash\textbullet~}X}
\setlength{\tabcolsep}{3pt}

\begin{document}

\noindent\begin{tabularx}{\linewidth}{>{\hsize=1.16\hsize\RaggedRight\arraybackslash}XYY*{2}{!{\quad}ZZZ}}
%\toprule
\multicolumn{3}{c}{\textbf{Computer Language}} & \multicolumn{3}{c}{\textbf{Tools}} & \multicolumn{3}{c}{\textbf{Hardware}} \\
\cmidrule(r{1.5em}){1-3}\cmidrule(lr{1.5em}){4-6}\cmidrule(lr{1.5em}){7-9}
%Methods & {Time [\si{\second}]} & {RunCount} & {Time [\si{\second}]} & {RunCount} \\
%\midrule
C \& C++ & Java & Python & item & item & item & item & item & item\\
MIPS Assembly & Bash & Verilog & some\-thing & item & item & item & item & item \\
%\bottomrule
\end{tabularx}

\end{document} 

enter image description here

1

You can add empty columns if you don't want to split into separate tables.

enter image description here

\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\noindent\begin{tabular}{lllclllclll}
%\toprule
\multicolumn{3}{c}{\textbf{Computer Language}} && \multicolumn{3}{c}{\textbf{Tools}} && \multicolumn{3}{c}{\textbf{Hardware}} \\
\cmidrule(r){1-3}\cmidrule(l){5-7}\cmidrule(l){9-11}
%\midrule
C \& C++ & Java & Python && item & item & item && item & item & item\\
MIPS Assembly & Bash & Verilog && something & item & item && item & item & item \\
%\bottomrule
\end{tabular}

If you want to increase (or decrease) the amount of extra space you can replace the cs with c@{\hskip 1cm}, or whatever length you want.

Alternatively, if you want to push the tables to the page margins, you can split into separate tables and use \hfill.

enter image description here

But if the tables are too wide, this will push the third table to the next line.

  • If I were to split it into separate tables, would it be possible to have the spacing auto-adjust dependent on the size of the three tables? I would just like the spacing to be as large as possible without kicking one of them tables to a new line. – hotelmariofan Mar 20 at 16:33
  • Yes. Please see my edit. – Sandy G Mar 20 at 16:43

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.