2

I have a table looks like exactly what I want, except for the first column from the left, the word Grain is not in the middle of the cells (I used cline{3-11} to hide the line but how to make the word Grain aligned in center ?

Thanks in advance!

\begin{table}[!h]
\label{T:equipos}
\begin{center}
\begin{tabular}{| c | c | c | c | c | c | c | c | c | c | c |}
\hline
\textbf{} & \textbf{} & \multicolumn{3}{ c |}{\textbf{Apple}} & \multicolumn{3}{c |}{\textbf{Corn}} & \multicolumn{3}{c |}{\textbf{Water}}\\ 


\cline{3-11}
\textbf{} &  & \textbf{Liquid} & \textbf{Fruit} & \textbf{Grain} & \textbf{Liquid} & \textbf{Fruit} & \textbf{Grain} & \textbf{Liquid}& \textbf{Fruit} & \textbf{Grain} \\
\hline


Grain & Max & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \cline{3-11} % this one
       & Avg & 3 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ \hline


Cereal & Max & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ \cline{3-11}
      & Avg & 3 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ \hline


\end{tabular}
\end{center}
\end{table}

enter image description here

  • Welcome to TeX.SE!. It would be very uselful if you make your code compilable, by adding \documentclass{...} and ending with \end{document}. – Cragfelt Mar 20 at 3:02
3

You can use command \multirow{2}{*}{Grain} to get the word Gain centered in the two table cells.

See the complete code:

\documentclass{article}

\usepackage{multirow}

\begin{document}
\begin{table}[!h]
\label{T:equipos}
\begin{center}
\begin{tabular}{| c | c | c | c | c | c | c | c | c | c | c |}
\hline
\textbf{} & \textbf{} & \multicolumn{3}{ c |}{\textbf{Apple}} & \multicolumn{3}{c |}{\textbf{Corn}} & \multicolumn{3}{c |}{\textbf{Water}}\\ 
\cline{3-11}
\textbf{} &  & \textbf{Liquid} & \textbf{Fruit} & \textbf{Grain} & \textbf{Liquid} & \textbf{Fruit} & \textbf{Grain} & \textbf{Liquid}& \textbf{Fruit} & \textbf{Grain} \\
\hline
\multirow{2}{*}{Grain} & Max & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \cline{3-11} % this one
                       & Avg & 3 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ \hline
\multirow{2}{*}{Cereal} & Max & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ \cline{3-11}
                        & Avg & 3 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ \hline
\end{tabular}
\end{center}
\end{table}
\end{document}

and the result:

resulting pdf

  • Thank you so much, it worked. I accepted the answer, but could not give you rate up because I am new :( – ananya Mar 20 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.