Tables – How to Break Cell into Multiple Rows

columnsmultirowtables

I have a table in LaTeX where I want 4 rows for every model. The second column has two possible values. So, I want the second column to have 2 rows per cell. Hence, the first column has 1 entry, the second column has 2 entries and the rest of the columns have 4 entries per cell. But, I am not able to figure out how to write two entries in the second column.

enter image description here

The code is:

\begin{table}
\centering
\begin{tabular}{ |l|l|l|l|l|l|l|l|l|l| }
\hline
Model & Optimizer & Embedding & LR & RC & Dimension & Rounds & Depth & Num Kernels & Dropout\\ \hline
\multirow{4}{*}{Logistic Regression} & Adam & Static &  &  & & & & & \\
 & Adam & Dynamic &  &  & & & & & \\
 & SGD & Static &  &  & & & & & \\
 & SGD & Dynamic &  &  & & & & & \\ \hline
\end{tabular}
\caption{Hyperparameter values of all the models after cross validation}
\label{table_1}
\end{table}

Best Answer

You just need to add \multirow{2}{*}{Adam} to the cell with the first Adam and \multirow{2}{*}{SGD} for the first SGD.

Please see the following MWE (because you gave no MWE I used the simplest one and got a table going over the right margin. Please try it with your code or complete your given code snippet to be compilable like this MWE):

\documentclass{article}

\usepackage{multirow}

\begin{document}
\begin{table}
\centering
\begin{tabular}{ |l|l|l|l|l|l|l|l|l|l| }
\hline
Model & Optimizer & Embedding & LR & RC & Dimension & Rounds & Depth & Num Kernels & Dropout\\ \hline
\multirow{4}{*}{Logistic Regression} & \multirow{2}{*}{Adam} & Static &  &  & & & & & \\
                                     &                       & Dynamic &  &  & & & & & \\
                                     & \multirow{2}{*}{SGD}  & Static &  &  & & & & & \\
                                     &                       & Dynamic &  &  & & & & & \\ \hline
\end{tabular}
\caption{Hyperparameter values of all the models after cross validation}
\label{table_1}
\end{table}
\end{document}

with the result:

enter image description here

Related Question