# back-hyperref the whole word in bibliography

Inspiring from this answer, we have

\documentclass[12pt,a4paper]{article}
%------------------------------------------------------------
\usepackage{amsmath,amssymb,amsthm}
%------------------------------------------------------------
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\newtheorem{corollary}{Corollary}[section]

\begin{document}

\begin{corollary}\label{cor}(\cite[Corollary 3]{4})
A unilateral weighted shift $T$ on ....
\end{corollary}

By \cref{cor}, there exists a polynomial......

\begin{thebibliography}{10}

\bibitem{4}{W. Arendt, J.R. Goldstein, and J.A. Goldstein:} {Outgrowths
of Hardy's inequality,} Contemp. Math. 412 (2006), pp. 51-68.

\end{thebibliography}

\end{document}
\end{document}


I hope that when I clic on the word Corollary 3, I go back to bibliography. However with my codes, I must only clic on the number 1 which is in red color. Like this picture

• – samcarter is at topanswers.xyz Jan 14 '19 at 13:48
• Thank you for the links. However I don't understand what should I do because it is not my question. My goalis a s follows: I hope that the word Corollary 3 will be colorated and when I clic on the word Corollary 3, I go back to bibliography. – Student Jan 14 '19 at 13:59

Similar to this answer, but we can exploit the fact that hyperref already sets an anchor for all citation entries.

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\newtheorem{corollary}{Corollary}[section]

\makeatletter
\makeatother

\begin{document}
A unilateral weighted shift $T$ on ....
\end{corollary}

By \cref{cor}, there exists a polynomial......

\begin{thebibliography}{10}

\bibitem{arendt}{W. Arendt, J.R. Goldstein, and J.A. Goldstein:} {Outgrowths
of Hardy's inequality,} Contemp. Math. 412 (2006), pp. 51-68.

\end{thebibliography}

\end{document}


If one wanted to do this properly, one would probably have to redefine \cite to also link the postnote argument, but that could end up quite tricky.

• How would modify that definition of \hyperlinkcite so as to create the postnote equivalent of \textcite? – murray Jan 14 '19 at 15:22
• @murray Sorry, I don't quite understand. Can you rephrase the question? \hyperlinkcite{<entrykey>}{<arbitrary text>} just prints <arbitrary text> as a hyperlink pointing to <entrykey> in the bibliography. That's why we had to use the slightly redundant \cite[\hyperlinkcite{arendt}{Corollary 3}]{arendt}. As I mentioned in the last paragraph, if one wanted \cite to add the link directly one would have to modify \cite, but I assume there are some subtle issues there w.r.t. postnotes of multiple citations and the definition of \cite can vary wildly with the used citation package. – moewe Jan 14 '19 at 15:26
• @moewe Thanks a lot for your answer. In view of your remark. I think we can proceed as follows: \definecolor{citeblue}{HTML}{617BAC} \makeatletter \def\ccitecolor{red} \def\ccite{% \@ifnextchar[{\@@ccite}{\@ccite}% } \def\@@ccite[#1]#2{% \hyperlink{cite.#2}{\cite[#1]{#2}}% } \def\@ccite#1{% \hyperlink{cite.#1}{\cite{#1}}% }\makeatother – Student Jan 14 '19 at 17:33
• @moewe Because I want that the braces [] are always colored. Please correct me if I made wrong. – Student Jan 14 '19 at 17:36
• @Student On first glance that looks OK. – moewe Jan 14 '19 at 18:59