3

I want to know what are the packages that do the following. When I cross-reference an Assumption or Theorem or cite a bibliographic entry ... I want that it will be colored in blue. I will put images to explain more what i mean enter image description here enter image description here

  • Probably hyperref with option colorlinks. You can choose the color of links via the key linkcolor=… – Bernard Feb 07 '15 at 15:24

2 Answers2

3

I suggest you do the following to get all citation call-outs and all cross-references to items (including the names of the items) colored in blue:

  • Load the hyperref package with the options colorlinks=true and allcolors=blue. This will assure that citation call-outs are colored in blue.

  • Load the cleveref package with the options nameinlink, noabbrev, and capitalize. (You can omit the latter two options if you're OK with abbreviated and lower-cased item names.)

  • Use the macro \cref to create cross-references to pages, sections, assumptions, equations, etc.

For (much) more on the subject of creating cross-references (including the cleveref package), I suggest reading the posting Cross-reference packages: which to use, which conflict?

enter image description here

\documentclass{article}
\usepackage[colorlinks=true,allcolors=blue]{hyperref}
\usepackage[nameinlink,noabbrev,capitalize]{cleveref}

\begin{document}
\section{Start} \label{sec:start}
\begin{equation}\label{eq:pyth}
a^2+b^2=c^2
\end{equation}

See \cref{sec:start} and \cref{eq:pyth}.
\end{document}
Mico
  • 506,678
0
\documentclass[]{article}
\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref]{hyperref}

\begin{document}

\newcommand*{\myref}[1]{{\color{blue}\ref{#1}}}

\section{Hello}
\label{sec:hello}

See Section \ref{sec:hello}.

\begin{equation}\label{eq:albert}
E=mc^2
\end{equation}

See~(\ref{eq:albert}).

\end{document}

EDIT

Code improved as suggest by Mico.

  • The OP mentioned wanting all cross-references in blue. I thus wouldn't mention the option urlcolor=black. The option allcolors=blue may be most appropriate for the OP's stated objective. – Mico Feb 07 '15 at 15:56
  • @Mico, with allcolors=blue the code do not work. – Giacomo Alessandroni Feb 07 '15 at 16:06
  • Hi, thank you Giacomo, in your example the numbers are colored it is OK but what I want is: when I refer as Equation~\ref{eq:albert}, I want that the word Equation will be colored also. Thank you – mathdatastatsml Feb 07 '15 at 16:15
  • That's strange -- the combination colorlinks=true,allcolors=blue works perfectly for me. – Mico Feb 07 '15 at 16:44
  • @Mico I work with MikTeX and Windows but... this do not must is a problem. – Giacomo Alessandroni Feb 07 '15 at 18:15
  • Please check if the code given in my answer (which also uses allcolors=blue, on a MacBook running MacTeX2014) compiles on your system. I can see no reason why it shouldn't when run on a Windows system and MikTeX. – Mico Feb 07 '15 at 18:21