1

Im working with a tex document with a lot of references. Im using:

\usepackage{hyperref}

\usepackage{varioref}

\usepackage{cleveref}

\hypersetup{colorlinks=true,citecolor=title,linkcolor=title,urlcolor = title}

Even so every reference has figure/table etc. in front of the numbering, by my professor thinks the references are too identical. Is there any way i can customize the references so \cref{fig:1} becomes figure 1.1 in blue, tables references becomes red, algorithm becomes bold algorithm 1.1 equation becomes with [ ], and a final reference uses a different **textsize/style**?

How to customize the references depended on what you are referring to?

1
  • Possibly irrelevant, but varioref should go before hyperref.
    – egreg
    Nov 15 '16 at 23:04
1

I would suggest using the \creflabelformat and \crefname definitions:

\documentclass{article}

\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{graphicx}


\creflabelformat{figure}{\color{red} \textbf{#1#2#3}}
\crefname{figure}{\color{blue} figure}{figures}
\creflabelformat{equation}{[#1#2#3]}
\crefname{equation}{equation}{equations}
\crefrangeformat{equation}{eqs. #3[#1]#4--#5[#2]#6}

\begin{document}
    \lipsum[1]

    \begin{figure}[h]

        \centering\includegraphics[width=0.5\textwidth]{example-image-a}
        \caption{Example image A\label{fig:fig1}}
    \end{figure}
    \lipsum[2]
    \cref{fig:fig1}

    \begin{equation}\label{eq:eq1}
        a^2 + b^2 = c^2
    \end{equation}

    \cref{eq:eq1}
\end{document}

enter image description here

Here I only changed the figure and equation, I leave the table and algorithm as an exercise for you :) . More about this in section 4 of the cleverref user guide.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.