Latex表格中多行合并后将内容居中显示
目标效果
Latex代码
\begin{table}[h]
\centering
\caption{Example Table with Merged Cells}
\begin{tabular}{|c|c|c|c|}
\hline
\textbf{Row 1, Col 1} & \multicolumn{2}{c|}{\textbf{Merged Cells}} & \textbf{Row 1, Col 4} \\
\hline
\textbf{Row 2, Col 1} & \multirow{2}{*}{\textbf{Merged}} & \textbf{Row 2, Col 3} & \textbf{Row 2, Col 4} \\
\cline{1-1} \cline{3-4}
\textbf{Row 3, Col 1} & & \textbf{Row 3, Col 3} & \textbf{Row 3, Col 4} \\
\hline
\end{tabular}
\end{table}
Problem
To merge cells in LaTeX tables and center the content within the merged cells, you can use the \multicolumn
command to merge cells horizontally