![当表格标题选择 textcolor = white 时,nameref 不会显示在主文本中](https://linux22.com/image/461712/%E5%BD%93%E8%A1%A8%E6%A0%BC%E6%A0%87%E9%A2%98%E9%80%89%E6%8B%A9%20textcolor%20%3D%20white%20%E6%97%B6%EF%BC%8Cnameref%20%E4%B8%8D%E4%BC%9A%E6%98%BE%E7%A4%BA%E5%9C%A8%E4%B8%BB%E6%96%87%E6%9C%AC%E4%B8%AD.png)
我有一张红色背景的表格,使用白色文字作为标题比使用黑色文字效果更好。这是通过使用以下方法实现的:
\begin{tcolorbox}[colback=yellow!10!white,colframe=csuOrange,title= \caption{
\textcolor{white}{Qualitative feedback from students in Bioethics courses.
}\label{table_evaluation_bioethics}}]
但是,尝试\nameref{}
在正文中使用来引用表格不会显示,因为文本是白色的。我尝试了几种方法来纠正这个问题,但都无济于事。一个例子是:
\textcolor{black}{\nameref{table_evaluation_bioethics}}
我在网上找不到任何提到类似问题的内容。任何帮助都将不胜感激。我可以使用简单的编号\ref{}
来代替,这也可以,但我更喜欢使用表名。
编辑:
这是一个重现该行为的最小示例:
\documentclass[12pt,a4paper]{article}
\usepackage{graphicx,amssymb, amstext, amsmath, epstopdf, booktabs, verbatim, gensymb, geometry, appendix, natbib, lmodern}
\geometry{letterpaper}
\usepackage[table]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{xltabular}
\usepackage{tabu}
\usepackage{nameref}
\usepackage{float}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage[english]{babel}
\usepackage{hyperref}
\usepackage{blindtext}
\definecolor{csuOrange}{RGB}{153,0,76}
\begin{document}
This is an example of using ref: see Table~\ref{table_evaluation_bioethics}.
This is an example of using nameref: see \nameref{table_evaluation_bioethics}.
The problem is the white text color for the caption.
\begin{table}[H]
\centering
\begin{tcolorbox}[colback=yellow!10!white,colframe=csuOrange,title= \caption{
\textcolor{white}{Qualitative feedback from students in Bioethics courses.}\label{table_evaluation_bioethics}}]
\taburulecolor{csuOrange}
\begin{xltabular}{\textwidth}{c | X | l}
\toprule
Course & Students' Feedback & \\
%%%%%%%%%%%Spring 2020%%%%%%%%%%%%%%%%
\midrule
%
\multirow{11}{*}{\rotatebox{90}{Section D}}
&
\blindtext
& \multirow{11}{*}{\rotatebox{90}{Spring 2018}}
\\
\midrule
\multirow{11}{*}{\rotatebox{90}{Section E}}
&
\blindtext
& \multirow{11}{*}{\rotatebox{90}{Fall 2018}}
\\
\bottomrule
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{xltabular}
\end{tcolorbox}
\end{table}
\end{document}
答案1
搞清楚了。 本身\caption
必须在\textcolor
命令内移动,才能不影响\hyperref
:
\begin{tcolorbox}[colback=yellow!10!white,colframe=csuOrange,title= \textcolor{white}{\caption{
Qualitative feedback from students in Bioethics courses.}\label{table_evaluation_bioethics}}]