2

I am using TexStudio with Bibtex. I want to color a multirow table. While, I have seen some questions put up earlier in this forum about that, however still I am not able to resolve the problem.

The code for a small sample table is given as follows:

 \begin{table}[]
\begin{tabular}{|c|c|c|c|}
    \hline
 \multirow{2}{*}{Methods} & \multicolumn{3}{c|}{Example 1} \\ \cline{2-4} 
& ISE      & IAE      & ITAE     \\ \hline
    Abc                      & 0.1      & 0.2      & 0.3      \\ \hline
    Xyz                      & 0.4      & 0.5      & 0.6      \\ \hline
\end{tabular}
\end{table}

Please guide me how to color the cell containing the word "Methods"

4

How about this? (cf. this answer.)

\documentclass{article}
\usepackage{colortbl,multirow,xcolor}
\begin{document}
\begin{table}[]
\begin{tabular}{|c|c|c|c|}
    \hline
\cellcolor{red!50}  & \multicolumn{3}{c|}{ Example 1} \\ \cline{2-4} 
\multirow{-2}{*}{\cellcolor{red!50} Methods} & ISE      & IAE      & ITAE     \\ \hline
    Abc                      & 0.1      & 0.2      & 0.3      \\ \hline
    Xyz                      & 0.4      & 0.5      & 0.6      \\ \hline
\end{tabular}
\end{table}
\end{document}

enter image description here

  • I want to color the cell having the word "Methods". When I use \cellcolor{red!50} to color methods, it colors only half of it. I want to color the complete cell "Methods" – ShiS Feb 21 at 5:16
  • @ShiS Sorry about this. Changed. – user121799 Feb 21 at 5:20

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.