以下 MWE(借自varioref:\vref 或 \vpageref 在页面边界(可能循环)) 表明页面边界处的\vref
和\vpageref
(从 开始)报告有错误(如果放在前言中,则报告有警告):varioref
\vrefwarning
包 varioref 错误:\vref 或 \vpageref 在页面边界 [...](可能循环)。
但是,如果cleveref
加载了,即使出现循环也不会有报告(就像 MWE 中该行% \usepackage{cleveref}
被注释掉时会发生的那样)。
cleveref
你知道即使使用了又如何获取报告吗?
\documentclass[12pt]{article}
\usepackage{blindtext,varioref}
% \usepackage{cleveref}
\makeatletter
\@ifpackageloaded{cleveref}{%
\newcommand{\crossref}{\vref{tab:example}}
}{%
\newcommand{\crossref}{table \vref{tab:example}}
}%
\makeatother
\newcommand{\test}{%
\blindtext[3]
These words are only for demonstration purposes. These words are only for
demonstration purposes. These words are only for demonstration purposes. These
words are only for demonstration purposes. These words are only for
demonstration purposes. These words are only for demonstration purposes. These
words are only for demonstration purposes. These words are only for
demonstration purposes. These words are only for ... See \crossref
\begin{table}[htbp]
\centering
\begin{tabular}{l}
Test\\
\end{tabular}
\caption{Example Table}
\label{tab:example}
\end{table}
\blindtext
}
\begin{document}
\test
\end{document}