# Using extended theorem names with \hyperref

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{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}%
\renewcommand\thetheorem{\thechapter.\arabic{theorem}}}
\newcommand\settheoremtosec{%
\@removefromreset{theorem}{chapter}%
\@removefromreset{theorem}{section}% just in case ... (no harm done)
\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}}

-
You can use the command \href. Try \href{einstein}{y Einsteins Theorem}. –  Marco Daniel May 2 '12 at 9:42
@MarcoDaniel: You surely meant \hyperref[einstein]{by Einsteins Theorem}, didn’t you? –  Speravir May 2 '12 at 18:17
@Speravir: I didn't test it ;-). I can do a test. –  Marco Daniel May 2 '12 at 18:18

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}


-
@ 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 '12 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. –  Harish Kumar May 2 '12 at 14:58
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8347848653793335, "perplexity": 3146.860087040416}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-41/segments/1412037663167.8/warc/CC-MAIN-20140930004103-00073-ip-10-234-18-248.ec2.internal.warc.gz"}