TeX - LaTeX Asked on March 26, 2021
I’m relatively new to creating tables in Latex and I aim to create the following. Unfortunately, I’m not sure especially how to create the left block ‘Np’. Any help is welcomed.
The following is my first approach using one of the examples mentioned in the comments:
documentclass[12pt]{article}
usepackage{booktabs}
begin{document}
begin{tabular}{llr}
toprule
multicolumn{2}{c}{Numerical Comparison}
cmidrule(r){1-2}
$N_p$ & TV & Anisotropic & Isotropic
midrule
20 &0.125 &0.151 &0.144
40 &0.065 &0.096 &0.088
60 &0.059 &0.077 &0.071
bottomrule
end{tabular}
end{document}
I get the following error: Extra alignment tab has been changed to cr
Note that I actually desire to have (as in the table example) for each TV/Isotropic/Anisotropic a subbar with different parameters besides error (like correlation, Time).
Since line-breaking inside cells isn't needed, I suggest you use a tabular*
environment instead of a tabularx
environment.
I would also align the numbers in the nine data columns on their respective decimal markers.
documentclass[12pt]{article}
usepackage[letterpaper,margin=1in]{geometry} % set page parameters suitably
usepackage{booktabs}
usepackage{siunitx} % for 'S' column type
newcolumntype{T}[1]{S[table-format=#1]} % handy shortcut macro
begin{document}
noindent
begingroup % localize scope of the next instruction
setlengthtabcolsep{0pt} % let LaTeX figure out intercol. sapce
begin{tabular*}{textwidth}{@{extracolsep{fill}}
c *{3}{T{2.1}T{2.1}T{3.0}} }
toprule
$N_p$ & multicolumn{3}{c}{Isotropic}
& multicolumn{3}{c}{Inpainting Once}
& multicolumn{3}{c}{Inpainting Twice}
cmidrule{2-4} cmidrule{5-7} cmidrule{8-10}
& {error} & {correlation} & {time} &
{error} & {correlation} & {time} &
{error} & {correlation} & {time}
midrule
10 & 13.6 & 98.4 & 113 & 12.4 & 98.7 & 285 & 12.3 & 98.7 & 411
15 & 8.4 & 99.4 & 135
20 & 6.2 & 99.7 & 140
bottomrule
end{tabular*}
endgroup
end{document}
Correct answer by Mico on March 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP