# How to color cited references in the bibiliographic part using \eqref{name}?

How to cite References in the bibiliographic part using \eqref{name}?

For example, suppose we have a line as follows:

Using the works of [X1] (I want to see a blue color box) , we get

where the reference is

\bibitem{X1} B. Dragovich, N. Z. Misic, p-Adic Invariant Summation of Some p-Adic Functional Series, p-Adic Numbers, Ultrametric Analysis and Applications, 2014.


I used to \label{X1} and using \eqref{X1}, I got

Using the works of (X1) (just X1 is red color and not obtained 3rd bracket also)

How to get [X1] with red color box ?

• Do you just want to have the link with a red frame, or also want an additional pair of round brackets around it? – Tiuri Nov 19 '19 at 7:46
• @Tiuri, I just want a blue color 3rd bracket around 'X1' – M. A. SARKAR Nov 19 '19 at 7:48
• It's still not clear to me. Can you please clarify exactly how the citation should look like: how many brackets of which type (round, square) and of which color? – Tiuri Nov 19 '19 at 7:50
• @Tiuri, square type – M. A. SARKAR Nov 19 '19 at 7:51
• I meant a code example, I know how citations look like. Without a compilable code, I will not be able to help you. However, some guidances: You should really use \cite to refer to the bibliography, not \ref or \eqref - that is most certainly also what was done in the arXiv paper you've linked. And then have a look at the hyperref documentation for how to adjust the colors of the links. Again, if you provide a minimal setup that describes what bibliography and citing macros you use, I'm happy to try to add the necessary adjustments there. – Tiuri Nov 19 '19 at 8:02

\eqref is not intended to refer to bibliography items, but to equations. The correct command to refer to bibliography items is \cite, the label is provided by the \bibitem command, so

\bibitem{X1} B. Dragovich...


can be cited with

\cite{X1}


To get colours, the standard apporach is to use the hyperef package. By default citations are coloured green, but you can change this. To get a blue box, use

\hypersetup{citebordercolor=0 0 1}


\documentclass{article}

\usepackage{hyperref}
\hypersetup{citebordercolor=0 0 1}

\begin{document}

Using the works of \cite{X1}, we get\dots

\begin{thebibliography}{9}
\bibitem{X1} B. Dragovich, N. Z. Misic, $p$-Adic Invariant Summation of
Some $p$-Adic Functional Series, $p$-Adic Numbers, Ultrametric Analysis
and Applications, 2014.
\end{thebibliography}

\end{document}


If instead you want blue text, then you can use

\hypersetup{colorlinks=true, citecolor=blue}


Alternatively, you can color citations commands without using hyperef, as follows

\documentclass{article}

\usepackage{color}
\makeatletter
\renewcommand*{\@cite}[1]{\fcolorbox{blue}{white}{#1}}
\renewcommand*{\@biblabel}[1]{{\fcolorbox{blue}{white}{#1}}\hfill}
\makeatother

\begin{document}

Using the works of \cite{X1}, we get\dots

\begin{thebibliography}{9}
\bibitem{X1} B. Dragovich, N. Z. Misic, $p$-Adic Invariant Summation of
Some $p$-Adic Functional Series, $p$-Adic Numbers, Ultrametric Analysis
and Applications, 2014.
\end{thebibliography}

\end{document}


Here I have redefined the printing command for citations, namely \@cite, to put the number in a box with a blue border via

\renewcommand*{\@cite}[1]{\fcolorbox{blue}{white}{#1}}


Here white is the background color apply, you could change this too if you wished. I have also changed the printing of the labels in the bibligraphy to match this style by redefining \@biblabel. Note for all this to work, you need to load the color package and to enclose the redefinitions in \makeatletter..\makeatother (due to the @ character in the macro names).

I can see no blue boxes in the pdf file you provided a link to. To create light-green boxes, as is one in the pdf file, use \cite rather than \ref or \eqref and load the hyperref package.

\documentclass{article}
\usepackage{amsmath} % for "\nobreakdash" macro

\usepackage{hyperref}

\begin{document}
\noindent
\dots\ \cite{X1} \dots

\begin{thebibliography}{9}

\bibitem{X1} B. Dragovich, N. Z. Misic, \padic{} Invariant Summation of Some \padic{}
Functional Series, \padic{} Numbers, Ultrametric Analysis and Applications, 2014.

\end{thebibliography}
\end{document}