1

I have the following table that consists of two tabulars. How can I align these two? Currently the first one is stretched, but only the last column. I would like the columns to be evenly distributed on the whole width, similar to the second (larger) tabular.

\documentclass[11pt,notitlepage]{article}
\usepackage[a4paper]{geometry}
\geometry{left=3cm,right=3cm,top=3cm,bottom=3cm,foot=1cm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, textcomp}
\usepackage{csquotes}
\usepackage{ragged2e}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{booktabs, makecell, longtable, tabularx, threeparttable}
\usepackage[font=small]{caption}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{pdflscape} 
\usepackage{caption}
\usepackage{booktabs}
\usepackage{pdfpages} 
\usepackage{enumitem} 
\usepackage{titling}
\usepackage[export]{adjustbox}
\usepackage{mathptmx}

\begin{document}

\begin{landscape}
\begin{table}
\centering
\caption{Test results}
\begin{tabular}{lrlrlrl}
Object 1 x Object 2 &   & \multicolumn{1}{r}{0.34345} & & Object 3 x Object 4 &   & \multicolumn{1}{r}{0.8794} \\
Test performance & & \multicolumn{1}{r}{0.33434} & & Test performance & & \multicolumn{1}{r}{0.1231} \\
Items involved & & Item A, Item B & & Items involved & & Item A, Item B \\
Score achieved & & \multicolumn{1}{r}{0.9999} & & Score achieved & & \multicolumn{1}{r}{0.6784} \\
Test result positive? & & yes  &  & Test result positive? & & yes \\
\hline
\begin{tabular}{lccccccccccccc}
\hline
Probability d1 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d2 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d3 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d4 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d5 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d6 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d7 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d8 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d9 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d10 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d11 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d12 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d13 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d14 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d15 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d16 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
\hline
\end{tabular}\\
\end{tabular}%

\end{table}%
\end{landscape}

\end{document}
1

Two different variants with slightly different alignment and spacing:

enter image description here

\documentclass[11pt,notitlepage]{article}
\usepackage[a4paper]{geometry}
\geometry{left=3cm,right=3cm,top=3cm,bottom=3cm,foot=1cm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, textcomp}
\usepackage{csquotes}
\usepackage{ragged2e}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{booktabs, makecell, longtable, tabularx, threeparttable}
\usepackage[font=small]{caption}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{pdflscape} 
\usepackage{caption}
\usepackage{booktabs}
\usepackage{pdfpages} 
\usepackage{enumitem} 
\usepackage{titling}
\usepackage[export]{adjustbox}
\usepackage{mathptmx}

\newsavebox{\mybox}
%\savebox{\mybox}{\parbox{4cm}{\lorem}}
%\showthe\wd\mybox 

\begin{document}

\begin{landscape}
\begin{table}
\centering
\caption{Test results}
\begin{tabular}{lccccccccccccc}
\hline
\multicolumn{14}{@{}c@{}}{
\begin{tabular}{lrlclrl}
Object 1 x Object 2 &   & \multicolumn{1}{r}{0.34345} & & Object 3 x Object 4 &   & \multicolumn{1}{r}{0.8794} \\
Test performance & & \multicolumn{1}{r}{0.33434} & & Test performance & & \multicolumn{1}{r}{0.1231} \\
Items involved & & Item A, Item B & & Items involved & & Item A, Item B \\
Score achieved & & \multicolumn{1}{r}{0.9999} & & Score achieved & & \multicolumn{1}{r}{0.6784} \\
Test result positive? & & yes  &  & Test result positive? & & yes \\
\end{tabular}}\\
\hline
Probability d1 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d2 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d3 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d4 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d5 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d6 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d7 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d8 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d9 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d10 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d11 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d12 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d13 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d14 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d15 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d16 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
\hline
\end{tabular}\\
%\end{tabular}%

\end{table}%
\end{landscape}


\begin{landscape}
\begin{table}
\centering
\caption{Test results}
\begin{tabular*}{0.85\linewidth}{@{}lrlc@{\extracolsep{\fill}}l@{\extracolsep{\tabcolsep}}rl@{}}
\hline
Object 1 x Object 2 &   & \multicolumn{1}{r}{0.34345} & & Object 3 x Object 4 &   & \multicolumn{1}{r}{0.8794} \\
Test performance & & \multicolumn{1}{r}{0.33434} & & Test performance & & \multicolumn{1}{r}{0.1231} \\
Items involved & & Item A, Item B & & Items involved & & Item A, Item B \\
Score achieved & & \multicolumn{1}{r}{0.9999} & & Score achieved & & \multicolumn{1}{r}{0.6784} \\
Test result positive? & & yes  &  & Test result positive? & & yes \\
\end{tabular*}\\
\begin{tabular*}{0.85\linewidth}{@{\extracolsep{\fill}}lccccccccccccc@{}}
\hline
Probability d1 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d2 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d3 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d4 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d5 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d6 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d7 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d8 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d9 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d10 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d11 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d12 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d13 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d14 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
Probability d15 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 & 0.123 \\
Probability d16 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 & 0.421 \\
\hline
\end{tabular*}

\end{table}%
\end{landscape}

\end{document}

Instead of \hline I'd recommend using the lines from booktabs.

| improve this answer | |
  • thanks that does the job. Sorry for late reply and acceptance, the site was down for me. – ghx Sep 27 '19 at 20:14

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.