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 lot
- 705
3 Answers
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}
- 70,770
- 10
- 176
- 283
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}
- 40,250
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}
- 705
-
1Good, that you figured it out by yourself! One remark,
\labelshould be\caption– marv Mar 20 '22 at 10:27 -
1Dear marv, thanks for the kind correction. I corrected my latex program as this may be useful for the newcomers here. – Dr. Sundar Mar 20 '22 at 11:40



\multicolumn(See also: How to merge columns in a table?) and to merge cells across rows, you can use\multirowfrom themultirowpackage (See also: How to merge cells vertically). – leandriis Mar 20 '22 at 08:51