Search code examples
latexoverleaf

Overleaf Latex: Create Table with Multiple Columns and Multiple Rows w/Sub-rows


I am trying to create the following table in LaTex with the exact layout shown below.

enter image description here

I also want to have the following Latex statements in my table code. They allow me to set a caption and label, respectively according to the formatting of a specific journal.

%   \caption{Model Execution Summary}
%   \label{tab:tablelabel}

I have scoured Google and tried many different solutions but none of them can produce even close to the layout of my desired table. I am also new to LaTex so this is a struggle.

Can someone show me how to do this in Latex please?


Solution

  • \documentclass[a4paper,12pt]{article}
    \usepackage{array, multirow}
    \usepackage{pdflscape}
    
    \pagestyle{empty}
    
    \begin{document}
    \begin{landscape}
    
    \begin{table}
    \centering
    \caption{Model Execution Summary}
    \label{tab:tablelabel}
       \begin{tabular}{|c|l|r|r|r|} 
    \cline{2-5}
        \multicolumn{1}{r|}{} & Algorithm & Column Shapes & Column Pair Trends & Quality Score\\
        \hline
        \multirow{4}{*}{Category 1546} & \textbf{Gaussian Copula} & \textbf{87.22\%} &\textbf{71.25\%} & \textbf{79.23\%} \\
                                       & CTGAN Neural Network     & 77.00\% & 79.96\% & 78.48\% \\
                                       & CopulaGAN Neural Network & 75.92\% & 74.23\% & 75.08\% \\
                                       & TVAE Autoencoders        & 72.66\% & 74.27\% & 73.46\% \\
        \hline
        \multirow{4}{*}{Category 155} & \textbf{Gaussian Copula} &\textbf{91.57\%} & \textbf{80.17\%} & \textbf{85.87\%} \\
                                      & CTGAN Neural Network & 84.14\% & 80.79\% & 82.47\% \\
                                      & CopulaGAN Neural Network & 84.09\% & 80.56\% & 82.32\% \\
        & TVAE Autoencoders & 85.50\% & 85.13\% & 85.41\% \\
        \hline
    \multirow{4}{*}{Category 8909} & \textbf{Gaussian Copula} & \textbf{95.64\%} & \textbf{81.96\%} &\textbf{88.80\%} \\
                                   & CTGAN Neural Network & 81.15\% & 79.84\% & 80.50\% \\
                                   & CopulaGAN Neural Network & 81.24\% & 82.18\% & 81.71\% \\
                                   & TVAE Autoencoders & 75.98\% &75.54\%& 75.76\% \\
        \hline
        \multirow{4}{*}{Category 8189} &\textbf{Gaussian Copula} & \textbf{95.08\%} & \textbf{82.63\%} & \textbf{88.86\%} \\
                                       & CTGAN Neural Network & 79.43\% & 85.87\% & 82.65\% \\
                                       & CopulaGAN Neural Network & 78.82\% & 83.60\% & 81.21\% \\
                                       & TVAE Autoencoders & 75.47\% & 77.57\% & 76.52\% \\
        \hline
        \multirow{4}{*}{Category 4162} & \textbf{Gaussian Copula} & \textbf{86.86\%} & \textbf{13.64\%} & \textbf{50.25\%} \\
                                       &CTGAN Neural Network & 86.62\% & 11.71\% & 49.16\% \\
                                       & CopulaGAN Neural Network & 87.60\% & 11.83\% & 49.71\% \\
                                       & TVAE Autoencoders & 86.20\% & 10.91\% & 48.55\% \\
        \hline
    \end{tabular}
    \end{table}
    \end{landscape}
    \end{document}
    
    

    With the following output
    enter image description here

    the exact layout shown below leads to the following twerks:

    • using the landscape package, due to its size
    • using the the multicolumn{1}{r|}{} to achive that cell in the up right corner has no borders