我对 usepackage 有疑问hyperref
。我只是在论文中链接到不同的定理、引理等,写作
Theorem \ref{text}
我在定理的相应编号周围得到了一个红色或绿色(取决于它是否是文献参考)框。假设有以人名命名的定理。是否可以在名称周围得到这个红色框?例如,假设我在第 2 页陈述了爱因斯坦定理。\label{einstein}
在第 10 页我提到了这个定理。我想写“按爱因斯坦定理”,并在爱因斯坦周围得到一个红色框。我该怎么做?
编辑:这是我的序言(其中的一部分):
\documentclass[10pt,twoside,openright]{thesis}
\usepackage{graphicx} % if you want to include graphics files
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage[pdftex,citecolor=green,linkcolor=red]{hyperref}
\usepackage{aliascnt}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem*{claim}{Claim}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\makeatletter
\newcommand\settheoremtochp{%
\@removefromreset{theorem}{chapter}% just in case ... (no harm done)
\@removefromreset{theorem}{section}%
\@addtoreset{theorem}{chapter}%
\renewcommand\thetheorem{\thechapter.\arabic{theorem}}}
\newcommand\settheoremtosec{%
\@removefromreset{theorem}{chapter}%
\@removefromreset{theorem}{section}% just in case ... (no harm done)
\@addtoreset{theorem}{section}%
\renewcommand\thetheorem{\thesection.\arabic{theorem}}}
\makeatother
% The preamble is also a good place to define new commands and macros.
% This part of the preamble is strictly optional according to your taste.
\newcommand{\R}{{\mathbb R}}
\newcommand{\nil}{\varnothing}
\newcommand{\N}{{\mathbb N}}
\newcommand{\A}{{\marhcal A}}
答案1
您可以使用它aliascnt
来创建一个类似于定理的计数器。
\documentclass{article}
\usepackage{aliascnt}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}
%------------------for refering to Einstein-----------------------------
\newaliascnt{lemmaa}{theorem}
\newtheorem{lemmaa}[lemmaa]{Einstein's theorem}
\aliascntresetthe{lemmaa}
\providecommand*{\lemmaaautorefname}{Einstein's theorem}
%------------------for using lemma-----------------------------
\newaliascnt{lemma}{theorem}
\newtheorem{lemma}[lemma]{Lemma}
\aliascntresetthe{lemma}
\providecommand*{\lemmaautorefname}{Lemma}
%-----------------------------------------------
\begin{document}
We will use \autoref{a} to prove \autoref{b}.
\begin{lemmaa}\label{a}
Nobody knows.
\end{lemmaa}
\begin{lemma}\label{c}
Nobody ever knows anything.
\end{lemma}
\aliascntresetthe{lemma}
\begin{theorem}\label{b}
Nobody is right.
\end{theorem}
My reference~\autoref{a} says that~\autoref{c} is wrong.
\end{document}