如何交叉引用定理

如何交叉引用定理

我在乳膠中寫了這樣的定理\begin{theorem} lllllll \end{theorem} 我希望當我引用這個定理時,我發現用藍色寫的“定理5.2”,然後單擊它我可以轉到所需的定理。

答案1

您需要載入一個包,例如amsthmntheorem,以簡化設定類似定理的環境。要將交叉引用標註製作為藍色超鏈接,您需要hyperref使用選項colorlinks和載入套件linkcolor=blue。我還建議您cleveref使用選項加載包nameinlink。然後,將指令與您希望交叉引用的每個定理相關聯,並使用and/or語句\label建立交叉引用呼叫。\cref\autoref

在此輸入影像描述

\documentclass{article}

\usepackage{amsmath,amssymb,amsthm}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage[nameinlink]{cleveref}
% Set up theorem-like environments:
\newtheorem{theorem}{Theorem}

\begin{document}
\counterwithin{theorem}{section} % just for this example
\setcounter{section}{5} \stepcounter{theorem}

\begin{theorem} \label{thm:important}
Bla bla bla
\end{theorem}

\noindent
A cross-reference to \autoref{thm:important}.
Another cross-reference to \cref{thm:important}.

\end{document}

相關內容