如何通过此代码更改多个页面上的表格背景标题颜色

如何通过此代码更改多个页面上的表格背景标题颜色

将标题背景颜色改为蓝色,而不是标题字体颜色。提前谢谢您

\begin{document}
\pagestyle{plain}

\lipsum[1-5]

%\pagestyle{empty}

\begin{landscape} % see = sign
\small
\setlength\extrarowheight{1pt}
\renewcommand\theadfont{\bfseries}
‎\begin{tabularx}{\linewidth}{@{}
                    >{\hsize=0.25\hsize}X 
                    >{\hsize=0.25\hsize}X
                    >{\hsize=0.25\hsize}X
                    >{\hsize=0.10\hsize}X
                    >{\hsize=0.15\hsize}X c
                              @{}}
\caption{Reported spectrophotometric methods for the analysis of Salbutamol sulphate}
\label{tab:mylongtable}         \\ \hline


  \thead[l]{Cmd}
& \thead[l]{Med} 
& \thead[c]{max}
& \thead[c]{Sol}
& \thead[c]{Sample}
& \thead[c]{Ref}   \\  \hline

\endfirsthead
%%%%
\caption{Reported spectrophotometric methods for the analysis of Salbutamol sulphate}
\label{tab:mylongtable2}         \\ \hline
  \thead[l]{Cmd}
& \thead[l]{Med} 
& \thead[c]{max}
& \thead[c]{Sol}
& \thead[c]{Sample}
& \thead[c]{Ref}   \\  \hline



\endhead
%%%%
\multicolumn{6}{r}{\textit{continue on the next page}}
\endfoot
%%%%
    \hline

\endlastfoot
%%%% table content see the = sign

 Salbutamol sulphate
& category
& \centering 500
& \centering deionized water
& \centering solid
&    [124]     \\ \hline

%%*********************************

Salb S.
& Spectroscopy
& \centering keto
& \centering methanol
& \centering solid
&  1    \\ \hline
%%*********************************


\end{tabularx}
\end{landscape}
\end{document}

答案1

如果我理解正确的话,那么您在专栏听众中寻找\rowcolor。使用``thead{...} this doesnt wotk well, so i sugest replace it withmulticolumn` 环境:

\newcommand\mcx[2]{\multicolumn{1}{#1}{\textbf{#2}}}

完整的 mwe 是:

\documentclass{article}
\usepackage{ltablex}
\newcommand\mcx[2]{\multicolumn{1}{#1}{\textbf{#2}}}
\usepackage[table]{xcolor}
\usepackage{pdflscape}


\begin{document}
\begin{landscape} % see = sign
\small
\setlength\extrarowheight{1pt}
‎\begin{tabularx}{\linewidth}{@{}
                    >{\hsize=0.25\hsize}X
                    >{\hsize=0.25\hsize}X
                    >{\hsize=0.25\hsize\centering}X
                    >{\hsize=0.10\hsize\centering}X
                    >{\hsize=0.15\hsize\centering}X
                            c
                              @{}
                              }
\caption{Reported spectrophotometric methods for the analysis of Salbutamol sulphate}
\label{tab:mylongtable}         \\
    \hline
    \rowcolor{blue!10}
  \mcx{l}{Cmd}
& \mcx{l}{Med}
& \mcx{c}{max}
& \mcx{c}{Sol}
& \mcx{c}{Sample}
& \mcx{c}{Ref}   \\
    \hline
\endfirsthead
%%%%
\caption{Reported spectrophotometric methods for the analysis of Salbutamol sulphate (cont.)}
\label{tab:mylongtable2}         \\
    \hline
    \rowcolor{blue!10}
  \mcx{l}{Cmd}
& \mcx{l}{Med}
& \mcx{c}{max}
& \mcx{c}{Sol}
& \mcx{c}{Sample}
& \mcx{c}{Ref}   \\  \hline
\endhead
    \hline
\multicolumn{6}{r}{\itshape\footnotesize continue on the next page}
\endfoot
    \hline
\endlastfoot
%%%%
    \hline
\endlastfoot
%%%% table content see the = sign
 Salbutamol sulphate
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    & category  & 500   & water & solid &    [124]     \\
    \hline
Salb S.
    & Spectroscopy  & keto  & methanol  & solid &  1    \\
%%*********************************
\end{tabularx}
\end{landscape}
\end{document}

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

相关内容