latexmultirow

Latex: issue with Multirow


I'm using the multirow package to have multiple elements in the same row.

\begin{table}[!h]
\centering
\resizebox{1.0\textwidth}{!}{%
    \begin{tabular}{l*{4}{c}|cc|c}
              & \mathcal{D} & $\rho$ & $N_c$ & $N_C^{inv}$ & $C$ & $C^{inv}$ & $Q$\\
    \hline
    \multirow{2}{*}{Mod0} & \num{9.99} & \num{1.36e+1} & \num{3.32} & \num{7.05e+1} & \num{4.69e-3} & \num{6.59e-2} & \num{1} \\
    & \num{-9.10} & \num{3.69e-1} & \num{-1.70e+1} & \num{-6.36e-2} & & &\num{1} \\ \hline
    Mod1 & \num{1.94e+1} & \num{1.60e+1} & \num{8.65e+1} & \num{1.86e+2} & \num{} \\
    \end{tabular}%
}
\end{table}

For the columns C and C^{inv} there is just one element (instead of two) and therefore I would like the single element to be in the centre of the line and not in the upper side. How can I do that?

enter image description here

The packages I'm using:

\documentclass[12pt, a4paper]{article}

\usepackage{siunitx}
\usepackage{enumitem}
\usepackage{verbatim}
\usepackage{multicol}
\usepackage{ dsfont }

\usepackage{xcolor}


\usepackage{movie15}
\usepackage[hidelinks]{hyperref}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mhchem}
\setcounter{MaxMatrixCols}{12}
\usepackage{commath}

\usepackage{graphicx} 
\usepackage{movie15}
\usepackage{hyperref}
\usepackage{wrapfig}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}

\usepackage{float}

\usepackage[margin=2cm,left=2.5cm,includefoot]{geometry}

\usepackage{lipsum}
\usepackage{subfig}
\usepackage{subfigure}


\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyfoot[R]{ \thepage\ }
\renewcommand{\headrulewidth}{1pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyfoot[R]{ \thepage\ }
\renewcommand{\headrulewidth}{1pt}
\renewcommand*\listtablename{Elenco Tabelle}
\renewcommand*\contentsname{Indice}

\usepackage{pythontex} 
\usepackage{minted}

Solution

  • You can use \multirow{2}{*}{...} to place the content in the centre of the two rows

    Off-topic:


    \documentclass{article}
    
    \usepackage{siunitx}
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage{graphicx} 
    \usepackage{multirow}
    \usepackage{float}
    \usepackage[margin=2cm,left=2.5cm,includefoot]{geometry}
    
    \begin{document}
    
    \begin{table}[htbp]
    \centering
    %\resizebox{1.0\textwidth}{!}{%
        \begin{tabular}{@{}l*{4}{c}|cc|c@{}}
                  & $\mathcal{D}$ & $\rho$ & $N_c$ & $N_C^{inv}$ & $C$ & $C^{inv}$ & $Q$\\
        \hline
        \multirow{2}{*}{Mod0} & \num{9.99} & \num{1.36e+1} & \num{3.32} & \num{7.05e+1} & \multirow{2}{*}{\num{4.69e-3}} & \multirow{2}{*}{\num{6.59e-2}} & \num{1} \\
        & \num{-9.10} & \num{3.69e-1} & \num{-1.70e+1} & \num{-6.36e-2} & & &\num{1} \\ \hline
        Mod1 & \num{1.94e+1} & \num{1.60e+1} & \num{8.65e+1} & \num{1.86e+2} & \num{} \\
        \end{tabular}%
    %}
    \end{table}
    
    \end{document}