使用 \multirow 后,我的表格如下所示。如何修复单元格,使其看起来完整且居中?

使用 \multirow 后,我的表格如下所示。如何修复单元格,使其看起来完整且居中?
\begin{table}[H]
  \centering
    \caption{The summary of FFNN design parameters and inputs}
    \label{tab:ffnn_smry}
    \begin{tabular}{|ll|}
    \hline
\textbf{Network Type} & FFNN \\ \hline
\multirow{3}{*}{\textbf{Input Parameters}} & $CO_2$ concentrations ($ppm$)& \\
& Ventilation rates ($L/s$) & \\
& Class schedule \\ \hline
\textbf{Target(s)} & Number of occupants \\ \hline
\textbf{Training Algorithm} & Bayesian regularization \\ \hline
\textbf{Number of Neurons} & 15 \\ \hline
\textbf{Performance} & MSE \\ \hline
    \end{tabular}
\end{table} 

答案1

第一行有&太多内容。

不过,我建议您添加一些额外的包,并使表格更具可读性。大批让你\extrarowheight在单元格内容上方添加一些空间,书签拥有更好的空间和更好的规则,三部分表将标题调整为表格宽度。参见示例 2。

在此处输入图片描述

\documentclass{article}

\usepackage{multirow}

\begin{document}



\begin{table}
  \centering
    \caption{The summary of FFNN design parameters and inputs}
    \label{tab:ffnn_smry}
    \begin{tabular}{|ll|}
    \hline
\textbf{Network Type} & FFNN \\ \hline
\multirow{3}{*}{\textbf{Input Parameters}} & $CO_2$ concentrations ($ppm$) \\
& Ventilation rates ($L/s$)  \\
& Class schedule \\ \hline
\textbf{Target(s)} & Number of occupants \\ \hline
\textbf{Training Algorithm} & Bayesian regularization \\ \hline
\textbf{Number of Neurons} & 15 \\ \hline
\textbf{Performance} & MSE \\ \hline
    \end{tabular}
\end{table} 

\end{document}

示例 2 - booktabs 等

在此处输入图片描述

\documentclass{article}

\usepackage{array, multirow, threeparttable, booktabs}
\setlength{\extrarowheight}{1pt}

\begin{document}

\begin{table}
\centering
\begin{threeparttable}

\caption{The summary of FFNN design parameters and inputs\label{tab:ffnn_smry}}
\begin{tabular}{@{}>{\bfseries}ll@{}}
\toprule
 Network Type                      & FFNN                        \\ \midrule
\multirow{3}{*}{Input Parameters} & $CO_2$ concentrations ($ppm$)\\
                                  & Ventilation rates ($L/s$)    \\
                                  & Class schedule               \\
\cmidrule(l){2-2}
Target(s)                         & Number of occupants           \\ 
Training Algorithm                & Bayesian regularization       \\ 
Number of Neurons                 & 15                            \\ 
Performance                       & MSE                           \\
\bottomrule
\end{tabular}
\end{threeparttable}

\end{table} 

\end{document}

相关内容