yeehaw
yeehaw

Reputation: 309

How to vertically center my latex table cell

My Latex tabular looks like this

\begin{table}
\centering
\begin{tabular}{clll}
\toprule
 \multirow{2}*{Name} & \multirow{2}*{Description} & \multicolumn{2}{c} 
  {Time}  \\
 \cline{3-4}  
   & & Item1 & Item2  \\
   \midrule
  App1 & Good & 1000ms  & 1000ms  \\

 \bottomrule
 \end{tabular}
  \end{table}

enter image description here'

I wonder how can I make Item1 and Item2 in the above table vertically-centered. Thank you!

Upvotes: 1

Views: 3877

Answers (1)

Eddymage
Eddymage

Reputation: 1137

You can use the command \cmidrule{3-4}: it is equivalent to \cline{3-4}, but it improves the looking of the table.

enter image description here

\documentclass{article}

\usepackage{multirow}
\usepackage{booktabs}
\begin{document}

\begin{table}
\begin{center}
  \begin{tabular}{clll}
    \toprule
    \multirow{2}*{Name} & \multirow{2}*{Description} & \multicolumn{2}{c} {Time}  \\
    \cmidrule{3-4}  
    & & Item1 & Item2  \\
    \midrule
    App1 & Good & 1000ms  & 1000ms  \\
    \bottomrule
  \end{tabular}  
\end{center}
\end{table}

\end{document}

Upvotes: 2

Related Questions