1

Please find the code and the corresponding output below

 \documentclass{article}
 \usepackage{colortbl}
 \begin{document}
\begin{table*}[]
\centering
\renewcommand{\arraystretch}{1.2}
    \caption{\textcolor{red}{Pole}}
\label{table5}
\begin{tabular}{|c|c|c|c|}
    \hline
    \begin{tabular}[c]{@{}c@{}}\textcolor{red}{OHO} \\ \textcolor{red}{MF} \\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{OYE}\\ \textcolor{red}{OME}\\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{RA}\\ \textcolor{red}{OY} \\ \textcolor{red}{M}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{FR}\\ \textcolor{red}{MOO}\\ \textcolor{red}{$M$}\end{tabular} \\\arrayrulecolor{red}  \hline
    \textcolor{red}{-1.5       }                                                                            & \textcolor{red}{-2}                                                                                                         &                                                                                                        &                                                                                      \\ \hline
    \textcolor{red}{-2.1634 + 1.2490i }                                                                                   & \textcolor{red}{-3}                                                                                                         
&                                                                                                        &                                                                                      
\\ \hline
    \textcolor{red}{-2.7     }                                                                              
   & \textcolor{red}{-4}                                                                                                         
      &                                                                                                        
       &                                                                                      
    \\ \hline
   \end{tabular}
 \end{table*}
  \end{document}

enter image description here

I want to make all the borders and the contents of the table in red color. However, as seen in the attached figure, the color of the topmost row and column is not coming in color. Also, the color of "Table 1: " is not in red color. So, my query is how to make the complete table in red color?

2
  • 1
    If you add \color{red} after \centering everything will become red.
    – user121799
    Commented Apr 17, 2019 at 5:09
  • Got it. But still "Table 1: " is not coming red. How to do that?
    – ShJ
    Commented Apr 17, 2019 at 5:11

1 Answer 1

1

I will be happy to remove this but when I compile

\documentclass{article}
 \usepackage{colortbl}
 \begin{document}
\begin{table*}[]
\centering\color{red}
\renewcommand{\arraystretch}{1.2}
    \caption{\textcolor{red}{Pole}}
\label{table5}
\begin{tabular}{|c|c|c|c|}
    \hline
    \begin{tabular}[c]{@{}c@{}}\textcolor{red}{OHO} \\ \textcolor{red}{MF} \\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{OYE}\\ \textcolor{red}{OME}\\ \textcolor{red}{$P$}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{RA}\\ \textcolor{red}{OY} \\ \textcolor{red}{M}\end{tabular} & \begin{tabular}[c]{@{}c@{}}\textcolor{red}{FR}\\ \textcolor{red}{MOO}\\ \textcolor{red}{$M$}\end{tabular} \\\arrayrulecolor{red}  \hline
    \textcolor{red}{-1.5       }                                                                            & \textcolor{red}{-2}                                                                                                         &                                                                                                        &                                                                                      \\ \hline
    \textcolor{red}{-2.1634 + 1.2490i }                                                                                   & \textcolor{red}{-3}                                                                                                         
&                                                                                                        &                                                                                      
\\ \hline
    \textcolor{red}{-2.7     }                                                                              
   & \textcolor{red}{-4}                                                                                                         
      &                                                                                                        
       &                                                                                      
    \\ \hline
   \end{tabular}
 \end{table*}
\end{document}

with pdflatex I get

enter image description here

If you load caption, you may want to try

\documentclass{article}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{caption}
\usepackage{amsmath}
\DeclareCaptionFont{red}{\color{red}} 
\begin{document}
\begin{table*}[]
\centering\color{red} \captionsetup{labelfont={red},textfont=red}
\renewcommand{\arraystretch}{1.2}
    \caption{Pole}
\label{table5}
\begin{tabular}{|c|c|c|c|}
    \hline
    \begin{tabular}[c]{@{}c@{}}OHO \\ MF \\ $P$\end{tabular} & \begin{tabular}[c]{@{}c@{}}OYE\\ OME\\ $P$\end{tabular} & \begin{tabular}[c]{@{}c@{}}RA\\ OY \\ M\end{tabular} & \begin{tabular}[c]{@{}c@{}}FR\\ MOO\\ $M$\end{tabular} \\\arrayrulecolor{red}  \hline
    $-1.5$                                                                        
              & $-2$                                                                                                         &                                                                                                        &                                                                                      \\ \hline
    $-2.1634 + 1.2490\,\mathrm{i}$                                                           
                            & $-3$                                                                                                         
&                                                                                                        &                                                                                      
\\ \hline
    $-2.7$                                                                              
   & $-4$                                                                                                         
      &                                                                                                        
       &                                                                                      
    \\ \hline
   \end{tabular}
 \end{table*}
\end{document}

enter image description here

5
  • Somehow when I try to compile this table in my complete document I am not getting it. But when I compile it individually alone I get the red color in "Table 1:". Seems like might be some package clash or something like that
    – ShJ
    Commented Apr 17, 2019 at 5:33
  • 1
    @ShiS Do you load the caption package? At least when I add \usepackage{caption} I also get a black caption.
    – user121799
    Commented Apr 17, 2019 at 5:34
  • Yes, I had loaded it. When I remove it, "Table 1" is coming in red, but a few other errors are coming. Isn't it possible to do it while using caption package
    – ShJ
    Commented Apr 17, 2019 at 5:36
  • 1
    @ShiS I added a proposal for that as well. (Of course you may want to drop some \textcolor commands and typeset the numbers in math mode and use \mathrm{i} for the imaginary i.)
    – user121799
    Commented Apr 17, 2019 at 5:40
  • 1
    This gives me exactly the output I wanted. Thanks. I have also dropped the redundant commands
    – ShJ
    Commented Apr 17, 2019 at 5:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .