I want to center the merged rows ac
vertically. How to do so?
\documentclass[preview,border=3pt]{standalone}
\usepackage{array,multirow}
\renewcommand\arraystretch{1.5}
\newcommand{\cell}[2]{%
$\displaystyle
\begin{array}{c}
{} #1 m \\
{} #2 n
\end{array}$}
\begin{document}
\begin{tabular}{|*{4}{c|}}\hline
\multicolumn{1}{|c|}{\multirow{2}{*}{$ac$}} &
$+$ &
\cell{+}{+} &
\cell{-}{-} \\\cline{2-4}
\multicolumn{1}{|c|}{} &
$-$ &
\cell{-}{+} &
\cell{+}{-} \\\hline
\multicolumn{2}{c|}{} &
$+$ &
$-$ \\\cline{3-4}
\multicolumn{2}{c|}{} &
\multicolumn{2}{c|}{$b$} \\\cline{3-4}
\end{tabular}
\end{document}
multirow
can take any number of rows as an option for fine tuning -- have a look below --\multirow{3.1}{*}{$ac$}}