Cleveref 没有建立链接:如何链接定理等?

Cleveref 没有建立链接:如何链接定理等?

下面的示例可能并不完全是“最小的”,因为我不确定是否存在任何软件包相互依赖关系,我希望您能够准确地看到我在做什么。理想情况下,我希望“Definition 1.0.1”的全部内容都链接到一个无色、无下划线的链接,当您在查看 PDF 时将鼠标放在它上面时,该链接主要可检测到。如果只有数字被链接,那就足够了,但不是那么好。当我提到“Theorem 2.0.1”时,我想要同样的东西。当我使用时,\ref没有链接,切换到\cref只会出现未链接的问号(用绿色箭头表示)。感谢您查看此内容。

在此处输入图片描述

\documentclass[letterpaper,twoside,notitlepage]{article}
\usepackage{graphicx}
\usepackage{bm}    
\usepackage{amssymb,amsmath}
\usepackage{mathrsfs}
\usepackage{titling}
\usepackage{bigints}
\usepackage{cite}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{longtable}
\usepackage{tabularray}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{centernot}
\usepackage{longtable}
\usepackage{textcomp}
\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\newif\iffirst\firsttrue %
\allowdisplaybreaks
\usepackage[left=1.5in,right=1.5in,top=0.75in,bottom=.75in,centering,includeheadfoot]{geometry}


 
%%%%%%%%%%%%%%%%%  THEOREM ENV's %%%%%%%%%%%%%%%%%%%
\usepackage[amsmath, thmmarks, thref]{ntheorem}
\newtheorem{thm}{Theorem}[subsection]
\newtheorem{defin}[thm]{Definition}
\theoremheaderfont{\itshape}
\theoremsymbol{\textleaf}
\newtheorem*{proof}{\textsf{\underline{Proof.}}}[subsection]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}
\large{
\setcounter{page}{1}
\section{First Fake Section}
\begin{defin}\label{def:DEF1}
    A definition is supposed to tell you what something means.  In this case, a definition is something I will want to link as a cross-referenced item later via the label.
\end{defin}

\section{Second Fake Section}
\begin{thm}\label{thm:THM1}
Even if I cite this with CREF later, there won't be the link I want.
\end{thm}

\begin{proof}
As in Definition \cref{def:DEF1}, this doesn't get linked.
\end{proof}


\section{Third Fake Section}
You can see that links are not happening for either Definition \cref{def:DEF1} or Theorem \cref{thm:THM1}.  For some reason, switching from REF to CREF just makes these question marks appear.
 
}
\end{document}

答案1

您必须加载ntheorem cleveref。并删除该thref选项。

我对你的代码做了一些更改,例如注释掉textcomp不再需要的代码;我hidelinks只是针对下面的图片进行了注释。

\documentclass[letterpaper,twoside,notitlepage]{article}
\usepackage[
  left=1.5in,
  right=1.5in,
  top=0.75in,
  bottom=0.75in,
  centering,
  includeheadfoot
]{geometry}
\usepackage{graphicx}
\usepackage{bm}    
\usepackage{amssymb,amsmath}
\usepackage[amsmath, thmmarks]{ntheorem}
\usepackage{mathrsfs}
\usepackage{titling}
\usepackage{bigints}
\usepackage{cite}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{longtable}
\usepackage{tabularray}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{centernot}
\usepackage{longtable}
%\usepackage{textcomp}
\usepackage[
  %hidelinks
]{hyperref}
\usepackage{cleveref}

\newif\iffirst\firsttrue %
\allowdisplaybreaks


 
%%%%%%%%%%%%%%%%%  THEOREM ENV's %%%%%%%%%%%%%%%%%%%
\newtheorem{thm}{Theorem}[section]
\newtheorem{defin}[thm]{Definition}
\theoremheaderfont{\itshape}
\theoremsymbol{\textleaf}
\newtheorem*{proof}{\textsf{\underline{Proof.}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\section{First Fake Section}

\begin{defin}\label{def:DEF1}
A definition is supposed to tell you what something means.  
In this case, a definition is something I will want to link 
as a cross-referenced item later via the label.
\end{defin}

\section{Second Fake Section}

\begin{thm}\label{thm:THM1}
Even if I cite this with CREF later, there won't be the link I want.
\end{thm}

\begin{proof}
As in \Cref{def:DEF1}, this doesn't get linked.
\end{proof}


\section{Third Fake Section}
You can see that links are not happening for either 
\Cref{def:DEF1} or \Cref{thm:THM1}.  
 
\end{document}

在此处输入图片描述

相关内容