-2

Dear friends: I have a special table to typeset in LaTeX for a journal paper, where some columns and rows are merged.. It is a simple table only and it can be easily done in MS-Word but I don't know how to do it in LaTeX. Kindly help me with the enclosed image (table). Thanks a lotenter image description here

1

3 Answers 3

4

Just for fun, the same table composed by tabularray. The first version v1 as your version and the second version v2 with a more professional composition.

\documentclass[12pt]{report}
\usepackage{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{table}
  \caption{Comparative analysis of Methods 1, 2 and 3 (v1)}
  \centering
  \begin{tblr}{
      colspec={|c|c|c|c|},
      row{1-2}={font=\bfseries},
    }
    \midrule
    \SetCell[r=2]{c} Parameters & \SetCell[c=2]{c} Existing Methods & & Proposed Method \\
    \midrule
    & Method 1 & Method 2 & Method 3  \\
    \midrule
    A & A1 & A2 & A3  \\
    \midrule
    B & B1 & B2 & B3  \\
    \midrule
  \end{tblr}
\end{table}
\begin{table}
  \caption{Comparative analysis of Methods 1, 2 and 3 (v2)}
  \centering
  \begin{tblr}{
      colspec={cccc},
      row{1-2}={font=\bfseries},
    }
    \SetCell[r=2]{c} Parameters & \SetCell[c=2]{c} Existing Methods &  & Proposed Method \\
    \cmidrule[lr]{2-3} \cmidrule[lr]{4}
    & Method 1 & Method 2 & Method 3 \\
    \midrule
    A & A1 & A2 & A3  \\ 
    B & B1 & B2 & B3  \\
  \end{tblr}
\end{table}
\end{document}

enter image description here

2

Here is a solution with {NiceTabular} of nicematrix.

\documentclass[12pt]{report}
\usepackage{nicematrix}
 
\begin{document}
 
\begin{table}

\renewcommand{\arraystretch}{1.5}
\centering
\begin{NiceTabular}{cccc}[hvlines]
\RowStyle[nb-rows=2]{\bfseries}
\Block{2-1}{Parameters} & \Block{1-2}{Existing Methods} && Proposed Method \\ 
 & Method 1 & Method 2 & Method 3 \\ 
 A & A1 & A2 & A3 \\ 
 B & B1 & B2 & B3 \\ 
\end{NiceTabular}

\caption{Comparative analysis of Methods 1, 2 and 3}

\end{table}

\end{document} 

Output of the above code

1

Thanks to the comment by leandriis, I tried to create a typesetting in LaTeX and the output is satisfactory.. I share my input file below..

\documentclass[12pt]{report}
 \usepackage{multirow}
 
 \begin{document}
 
 \begin{table}
  \renewcommand{\arraystretch}{1.5}
 \centering
\begin{tabular}{|c|c|c|c|}
\hline
\multirow{2}{*}{\textbf{Parameters}} & \multicolumn{2}{ c| }{\textbf{Existing Methods}}& \textbf{Proposed Method} \\ 
\cline{2-4}
 & \textbf{Method 1} & \textbf{Method 2} & \textbf{Method 3} \\ \hline
 A & A1 & A2 & A3 \\ \hline
 B & B1 & B2 & B3 \\ \hline 
\end{tabular}
\caption{Comparative analysis of Methods 1, 2 and 3}
\end{table}

\end{document} 

LaTeX Output - Table

2
  • 1
    Good, that you figured it out by yourself! One remark, \label should be \caption
    – marv
    Commented Mar 20, 2022 at 10:27
  • 1
    Dear marv, thanks for the kind correction. I corrected my latex program as this may be useful for the newcomers here.
    – Dr. Sundar
    Commented Mar 20, 2022 at 11:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .