# How to custom merge rows in Latex?

I have tried different approaches however nothing works.

Any suggestions for creating a table with this layout? If I create 2 multirows (each with 2 rows-X and Y), I am not sure how to merge them for column c2 and c3. Thanks!

This is one example (spacing is all weird).

\usepackage{makecell}
\begin{table}[h]
\caption{Design of Experiment1} % title name of the table
\centering % centering table
\begin{tabular}{c c c c} % creating 4 columns
\hline\hline % inserting double-line
\\ [0.5ex]
Group &Training &Reversal &Notation
\\ [0.1ex]
\hline % inserts single-line
\\ [0.5ex]
% 1st row
& &  & WT L1(+||-)  \\[1ex]
% 2nd row row
\raisebox{1.5ex}{WT} & &  & WT L2(-||+)  \\[1ex]
% 3rd row
& &  & HET L1(+||-)  \\[1ex]
% 4th row
\raisebox{1.5ex}{HET} & \raisebox{2ex} {\makecell{L1 reinforced  (L+) \\ L2
non-reinforced (L-)}} & \raisebox{2ex}{\makecell{L1 non-reinforced (L-) \\
L2 reinforced (L+)}}   & WT L2(-||+)\\[1ex]

\hline % inserts single-line
\end{tabular}
\label{tab:PPer}
\end{table}

• Possible duplicate of How to merge cells vertically – Y Davis Jun 12 '18 at 13:28
• It is not a duplicate, because what I am not able to do is merge after creating multirow. I can create 2 multirows (each with 2 rows- for X and Y), however I am not sure how to merge them in the 2nd and 3rd column. – Adela Iliescu Jun 12 '18 at 13:37
• @AdelaIliescu: In this case, please show a minimal working example (MWE) of what you tried so far. This way it is much easier to help you. – leandriis Jun 12 '18 at 13:43

## 1 Answer

Like this?

\documentclass{article}
\usepackage{array, multirow, boldline}

\begin{document}

\begin{table}[!h]
\centering\sffamily\setlength{\extrarowheight}{2pt}
\begin{tabular}{V{2.5}*{3}{>{\centering\arraybackslash}m{1cm}|}>{\centering\arraybackslash}m{1cm}V{2.5}}
\hlineB{2.5}
c1 &c2 & c3 & c4 \\
\hlineB{2}
\multirow{2}{*}{X} & & & a\\
& \multirow{2}{*}{XY}& \multirow{2}{*}{YZ} & b \\
\cline{1-1}\cline{4-4}
\multirow{2}{*}{Y} & & & c \\
& & & d \\
\hlineB{2.5}
\end{tabular}
\end{table}

\end{document}


• @AdelaIliescu: I don't quite understand what should be the multirows of the 2nd and 3rd columns – Bernard Jun 12 '18 at 15:27
• It's a design table for an experiment. X and Y are two groups that receive the same treatment in phase c2 and c3 but not c4. – Adela Iliescu Jun 27 '18 at 8:14