[Tex/LaTex] How to color citation brackets using hyperref

colorhyperref

I want to color the brackets of inline citation like: some text[9] where it is written in latex like this some text\cite{9}. Now hyperref only colors the number "9" without the brackets "[]". Is there any workaround for this?

Best Answer

You can use the cite package:

\documentclass{article}
\usepackage{color}
\usepackage{hyperref}
\usepackage{cite}
\renewcommand{\citeleft}{\textcolor{red}{[}}
\renewcommand{\citeright}{\textcolor{red}{]}}
\begin{document}
Hello \cite{world}!
\begin{thebibliography}{99}
\bibitem{world} created some time ago
\end{thebibliography}
\end{document}
Related Question