请参阅下面的代码和相应的输出
\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}
我想将表格的所有边框和内容都变成红色。但是,如附图所示,最上面一行和一列的颜色没有变色。此外,“表格 1:”的颜色也不是红色。所以,我的疑问是如何将整个表格变成红色?
答案1
我很乐意删除它,但是当我编译时
\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}
我pdflatex
得到
如果你加载caption
,你可能想尝试
\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}