# Impose vertical displacement in one column in tabular environment

I have a simple table with three columns, split (by an \hline) into the first two rows and the last two rows. Here is a minimum working example:

\documentclass{article}

\begin{document}

\begin{tabular}{cc|c}
a & b & xx \\
c & d & xx \\ \hline
e & f & yy \\
g & h & yy
\end{tabular}

\end{document}


The entries in the right-most column represent a comparison of the associated two rows: thus the xx refers to a comparison of the first two rows and the yy refers to a comparison of the last two rows. As such, there should be just a single entry of xx and a single entry of yy. I would like a single xx to lie vertically between the first and second rows (to make it clear it refers to both rows), and likewise the yy to lie vertically between the third and fourth rows.

• You are looking for multirow. – user156344 Apr 20 '19 at 18:08

Like this?

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{tabular}{cc|c}
a & b & \multirow{2}{*}{xx} \\
c & d & \\ \hline
e & f & \multirow{2}{*}{yy} \\
g & h &
\end{tabular}

\end{document}


• You folks are so helpful. Thanks so very much! (accept) – David G. Stork Apr 20 '19 at 18:11