2

I've a question about the usepackage hyperref. I just link to the different theorems, lemmas etc. in my paper, writing

Theorem \ref{text}

I get a red or green (depends if it is a literature reference or not) box around the accordant number of the Theorem. Suppose there are Theorems, named after a Person. Is it possible to get this red box around the name? For example, suppose I stated the Einsteins Theorem on page 2, \label{einstein}. On page 10 I refer to this Theorem. I would like to write, "by Einsteins Theorem" an get a red box around Einstein. How can I do this?

Edit: Here is my preamble (a part of it):

\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}}
3
  • You can use the command \href. Try \href{einstein}{y Einsteins Theorem}. May 2, 2012 at 9:42
  • @MarcoDaniel: You surely meant \hyperref[einstein]{by Einsteins Theorem}, didn’t you?
    – Speravir
    May 2, 2012 at 18:17
  • @Speravir: I didn't test it ;-). I can do a test. May 2, 2012 at 18:18

1 Answer 1

6

You can use aliascnt to create a counter similar to theorem.

\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}

enter image description here

2
  • @ Harish Kumar: Thank you for your answer. How ever, I've some question. How do I have to change my preamble, see my code, added in my question. I do not know why you are defining a new lemmaa? Thanks for your help
    – m. th
    May 2, 2012 at 12:08
  • @math: I defined lemmaa so that you can still use lemma. Put the lines enclosed between dashed lines in my code preamble right after \newtheorem{theorem}{Theorem}[section] in your preamble.
    – user11232
    May 2, 2012 at 14:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .