我正在写一篇论文,并使用 \cref 作为参考文献。但是每个 \cref 都提供了一条警告,指出“抑制空链接”。我可以忽略这些警告,但实际上警告太多了,以至于它们开始堵塞消息日志。有什么想法可以删除这些空链接吗?
\hypersetup{
colorlinks = true,
citecolor = title,
linkcolor = title,
urlcolor = title
}
\usepackage[noabbrev]{cleveref}
\creflabelformat{figure}{\color{tudelft-dark-blue} \textbf{#1#2#3}}
\crefname{figure}{figure}{figures}
\creflabelformat{table}{\color{tudelft-dark-blue} \textbf{#1#2#3}}
\crefname{table}{table}{table}
\creflabelformat{equation}{[#1#2#3]}
\creflabelformat{equation}{\color{tudelft-dark-blue}(#1#2#3)}
\crefname{equation}{\color{tudelft-dark-blue}equation}{equations}
\crefrangeformat{equation}{eq. #3[#1]#4--#5[#2]#6}
\crefrangeformat{equation}{equation #3#1#4--#5#2#6}
答案1
参考资料确实是空的:
\creflabelformat{figure}{\color{tudelft-dark-blue} \textbf{#1#2#3}}
#1
是参考文本、#2
开始链接和#3
结束链接。顺序应该是#2#1#3
:
\documentclass{article}
\usepackage{xcolor}
\colorlet{title}{blue}
\colorlet{tudelft-dark-blue}{blue!50!black}
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
citecolor = title,
linkcolor = title,
urlcolor = title
}
\usepackage[noabbrev]{cleveref}
\creflabelformat{figure}{\color{tudelft-dark-blue} \textbf{#2#1#3}}
\crefname{figure}{figure}{figures}
\creflabelformat{table}{\color{tudelft-dark-blue} \textbf{#2#1#3}}
\crefname{table}{table}{table}
\creflabelformat{equation}{[#2#1#3]}
\creflabelformat{equation}{\color{tudelft-dark-blue}(#2#1#3)}
\crefname{equation}{\color{tudelft-dark-blue}equation}{equations}
\crefrangeformat{equation}{eq. #3[#1]#4--#5[#2]#6}
\crefrangeformat{equation}{equation #3#1#4--#5#2#6}
\begin{document}
\section{Section}\label{sec:section}
\begin{equation}E=mc^2\label{eq:equation}\end{equation}
\begin{figure}\caption{Caption}\label{fig:figure}\end{figure}
Section \cref{sec:section}\\
Equation \cref{eq:equation}\\
Figure \cref{fig:figure}
\end{document}