TransWikia.com

How to create a table with advanced titles (multi layers)

TeX - LaTeX Asked by Mr. E on July 13, 2021

I am trying to create a table that would look something like this but I am struggling with how to put an additional text

What I want to achieve:

-------------------------------------------------------
                                    Birth date
Name           Surname        day    Month    Year   
-------------------------------------------------------
Jimmy          Neutron        26      9       1834
Bob             Ross          32      2       1234
-------------------------------------------------------

What I have now:

begin{table}[h!]
    centering
    begin{tabular}{ l r r l }
        toprule
         &  & Date  
        Name & Surname & day &  month & year   
        midrule
        Jimmy & Neutron & 20 & 09 & 1984 
        Bob & Ross & 2 & 12 & 1184 
        bottomrule
    end{tabular}
    caption{Body segment length measurements}
end{table}

One Answer

Your problem is solved by @Bernard comment, however, in your code fragment you defined four columns, but you need five. I suggest to change their type as is done in the following example:

documentclass{article}
usepackage{booktabs}

begin{document}
begin{table}[h!]
    centering
    begin{tabular}{ r l ccc }
        toprule
                &           & multicolumn{3}{c}{Date}  
        cmidrule{3-5}
        Name    & Surname   & day   & month & year      
        midrule
        Jimmy   & Neutron   & 20    & 09    & 1984      
        Bob     & Ross      & 2     & 12    & 1184 
        bottomrule
    end{tabular}
    caption{Body segment length measurements}
end{table}
end{document}

enter image description here

Correct answer by Zarko on July 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP