5

Before requesting help I tried to find the way myself using \cline \multicolumns and \multirows without success.

How do I get the table with the layout below ?

table layout

EDIT:

my attempt:

\documentclass[a4paper]{report}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\begin{table}[h]
\begin{center}
\renewcommand{\arraystretch}{2}
\begin{tabular}{|m{2cm}|m{2cm}|m{3cm}|m{2cm}|m{2cm}|}
\hline
\multirow{2}*{text} & \multirow{2}*{text} & \multirow{2}*{text} & \multicolumn{2}{c|}{text}\\
\cline{1-3}
1 & 2 & 3 & 4 & 5\\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
0

2 Answers 2

4

You almost achieve what you like to have :-)

\documentclass[a4paper]{report}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\begin{table}[h]
\centering
\renewcommand{\arraystretch}{2}
\begin{tabular}{|m{2cm}|m{2cm}|m{3cm}|m{2cm}|m{2cm}|}
\hline
\multirow{2}*{text} & \multirow{2}*{text} & \multirow{2}*{text} & \multicolumn{2}{c|}{text}\\
    \cline{4-5}
  &   &   & 4 & 5\\
    \hline
1 & 2 & 3 & 4 & 5\\
\hline
\end{tabular}
\end{table}
\end{document}

enter image description here

0

Here is how you can do that table with {NiceTabular} of nicematrix.

In that environment, which is similar to {tabular} (of array), you merge cells both vertically and horizontally with the command \Block and the key hvlines draws all the rules excepted in the blocks (created by \Block).

\documentclass[a4paper]{report}
\usepackage{nicematrix}
\begin{document}
\begin{table}[h]
\centering
\renewcommand{\arraystretch}{2}
\begin{NiceTabular}{m{2cm}m{2cm}m{3cm}m{2cm}m{2cm}}[hvlines]
\Block{2-1}{text} & \Block{2-1}{text} & \Block{2-1}{text} & \Block{1-2}{text}\\
  &   &   & 4 & 5\\
1 & 2 & 3 & 4 & 5\\
\end{NiceTabular}
\end{table}
\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

You must log in to answer this question.

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