0

How to centre \multirow cell?

Column is centred, but \multirow cell is aligned to left. If I try \begin{center} and \end{center} (commented part of the code) it does not work.

Also, if I remove cell width from the code, e.g. \multirow{3}{*} instead of \multirow{3}{15mm}, \multirow is centred, but the text does not break.

\documentclass[12pt,oneside,a4paper]{book}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{amsmath}
\newcolumntype{K}[1]{>{\centering\arraybackslash}p{#1}}

\begin{document}
    
\begin{table} [!t]
\footnotesize
\caption{Summary}
\centering
    \begin{tabular}{| K{5mm} | K{15mm} | K{15mm} | }
        \cline{1-3}
        \multirow{2}{*}{No} & \multicolumn{2}{c|}{Modulation} \\ \cline{2-3}
        & Phase & Leg \\ \cline{1-3}
        1 & $V_{\text{tri}}$ & $V_{\text{tri}}$ \\ \cline{1-3}
        2 & \multirow{3}{15mm}{Active Zero State} & $V_{\text{tri}}$ \\ \cline{1-1} \cline{3-3} 
        %2 & \multirow{3}{15mm}{\begin{center}Active Zero State\end{center}}& $V_{\text{tri}}$ \\ \cline{1-1} \cline{3-3}
        3 & & XOR \\ \cline{1-1} \cline{3-3}
        4 & & Thld \\ \cline{1-3}
        5 & \multirow{3}{15mm}{NS} & $V_{\text{tri}}$ \\ \cline{1-1} \cline{3-3} 
        6 & & XOR \\ \cline{1-1} \cline{3-3}
        7 & & Thld \\ \cline{1-3}
        7 & Test & Test \\ \cline{1-3}
    \end{tabular}
\end{table}
\end{document} 

enter image description here

1 Answer 1

0

You do not have to specify the multirow width: you can use the key = to specify it has the width if the column. Simply adding \centering works:

\documentclass[12pt,oneside,a4paper]{book}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{amsmath}
\newcolumntype{K}[1]{>{\centering\arraybackslash}p{#1}}

\begin{document}

\begin{table} [!t]
\footnotesize\setlength{\extrarowheight}{3pt}
\caption{Summary}
\centering
    \begin{tabular}{| K{5mm} | K{15mm} | K{15mm} | }
        \cline{1-3}
        \multirow{2}{*}{No} & \multicolumn{2}{c|}{Modulation} \\ \cline{2-3}
        & Phase & Leg \\ \cline{1-3}
        1 & $V_{\text{tri}}$ & $V_{\text{tri}}$ \\ \cline{1-3}
        2 & \multirow{3}{=}{\centering Active Zero State} & $V_{\text{tri}}$ \\ \cline{1-1} \cline{3-3}            
        3 & & XOR \\ \cline{1-1} \cline{3-3}
        4 & & Thld \\ \cline{1-3}
        5 & \multirow{3}{=}{\centering NS} & $V_{\text{tri}}$ \\ \cline{1-1} \cline{3-3}
        6 & & XOR \\ \cline{1-1} \cline{3-3}
        7 & & Thld \\ \cline{1-3}
        7 & Test & Test \\ \cline{1-3}
    \end{tabular}
\end{table}

\end{document} 

enter image description here

You must log in to answer this question.

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