
我在乳膠中寫了這樣的定理\begin{theorem} lllllll \end{theorem} 我希望當我引用這個定理時,我發現用藍色寫的“定理5.2”,然後單擊它我可以轉到所需的定理。
答案1
您需要載入一個包,例如amsthm
或ntheorem
,以簡化設定類似定理的環境。要將交叉引用標註製作為藍色超鏈接,您需要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}