我不知道为什么\rowcolors
颜色也是如此\caption
。 MWE 本身没有多大意义,但应该可以说明问题。
\documentclass[a4paper,11pt,english]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{xltabular}
\usepackage{booktabs}
\aboverulesep=0pt
\belowrulesep=0pt
\cmidrulekern=-\tabcolsep
\definecolor{HTML-D0}{HTML}{E03E2D}
\usepackage{caption}
\captionsetup[table]{font=small, format=hang}
\definecolor{HTML-B2}{HTML}{3598db}
\usepackage{ragged2e} % Allow left, center and right alignment
\begin{document}
{\rowcolors{1}{HTML-B2}{HTML-B2}
\noindent
\begin{xltabular}{\textwidth}{!{\color{HTML-D0}\vrule width 65536sp} X X}
\arrayrulecolor{HTML-D0}\midrule[65536sp]\arrayrulecolor{black}
Mugur &\Centering{} 3\\
\midrule[65536sp]
\caption{Main}\end{xltabular}
}
\end{document}
答案1
您可以使用\hiderowcolors
,如果需要,重新启动\showrowcolors
\documentclass[a4paper,11pt,english]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{xltabular}
\usepackage{booktabs}
\aboverulesep=0pt
\belowrulesep=0pt
\cmidrulekern=-\tabcolsep
\definecolor{HTML-D0}{HTML}{E03E2D}
\usepackage{caption}
\captionsetup[table]{font=small, format=hang}
\definecolor{HTML-B2}{HTML}{3598db}
\usepackage{ragged2e} % Allow left, center and right alignment
\begin{document}
{\rowcolors{1}{HTML-B2}{HTML-B2}
\begin{xltabular}{\textwidth}{!{\color{HTML-D0}\vrule width 65536sp} X X}
\arrayrulecolor{HTML-D0}\midrule[65536sp]\arrayrulecolor{black}
Mugur &\Centering{} 3\\
\midrule[65536sp]
\hiderowcolors\caption{Main}\\
\showrowcolors
aa&bb
\end{xltabular}
}
\end{document}