Bold cross references

I'm writing my PhD thesis in LaTeX and I have a lot of figures - each one is referenced within the text. So I have:

\begin{figure}[h]
...
...
\label{fig:stuff}
\end{figure}


then, later, in the text:

blah blah blah this is shown in \ref{fig:stuff}, which indicates blah blah


and I get:

blah blah blah this is shown in Figure 2.7, which indicates blah blah


I want to make "Figure 2.7" bold - I'm loading the caption package with the labelfont=bf option so that it's bold in the caption of the figure itself, but I'd also like it to be bold in the text. I guess I could do this with

blah blah blah this is shown in \textbf{\ref{fig:stuff}}, which indicates blah blah


but ideally I'd like not to have to change multiple references to all 71 figures...

Any ideas?

• Just from a typographic point of view: I don't think this is a good idea, as it will optically emphasize your references very much and make it stand out of the grey value of the text. – Benedikt Bauer Dec 21 '12 at 21:52
• Some journals want you to emphasize the first occurrence of a figure reference in bold (not all). This is probably more difficult to achieve it automatically. – Hotschke Aug 10 '15 at 14:18

I assume that you want to bold-face your cross-references to make them stand out strongly in the text. However, this is a dubious practice from a typographic point of view. Rather than bold-facing the cross-references, I'd suggest that you make them into hyperlinks that can be assigned a color. To do this, start by loading the hyperref package with the colorlinks option set. Then, use the \autoref command that's provided by the hyperref package to create colored hyperlinks to the objects being cross-referenced. Note that the \autoref command is what one might term fully dynamic: it typesets both the type (such as equation, figure, table, section, etc.) and the number of the cross-referenced object. By using the \autoref command, the hyperlink "target" (the part that's colored) will be highly visible, because it consists of both the type and number of the item being cross-referenced.

An even more flexible and powerful cross-referencing command than \autoref is \cref, provided by the cleveref package; I suggest that you load the cleveref package the nameinlink option set. (Even if you do use \cref, I still recommend you also load the hyperref package with the colorlinks option set. If you load both hyperref and cleveref, be sure to load hyperref first.) Like \autoref, \cref is fully dynamic; the nameinlink option forces the link to consist of both the item's type and number. Unlike \autoref, \cref lets you create cross-references to multiple items of the same type (e.g., equations) and even multiple items of differing types all in one cross-referencing command; the cleveref package will nicely sort and typeset the cross-references being generated without the user having to worry about such details.

For much more on various cross-referencing commands and packages in general, and the hyperref and cleveref packages in particular, see the answers to the question Cross-reference packages: which to use, which conflict?

• The twelfth upvote on this answer gave me 120K total reputation points. Many thanks to everyone who uses this great site! – Mico Jul 13 '15 at 23:38

Just redefine \ref:

\let\origref\ref
\def\ref#1{\textbf{\origref{#1}}}

• If hyperref is loaded this is dangerous; it's better to say \LetLtxMacro{\latexref}{\ref} (it needs the letltxmacro package). – egreg Dec 21 '12 at 22:22
• Surely. My answer is a quick hack which breaks a lot of things... – Boris Dec 21 '12 at 22:54
• Instead of redefine \ref, why not define a new one: \newcommand{\bref}[1]{\textbf{\ref{#1}}? – Manuel Dec 21 '12 at 23:09
• This also works, but if you have a long doc with \refs, it might be easier to redefine \ref. – Boris Dec 21 '12 at 23:24

To achieve this you can add in the preamble:

\usepackage[capitalise]{cleveref} % load after hyperref package
\crefdefaultlabelformat{\textbf{#2#1#3}} % boldface only the number

% boldface only the type in front of the number
\crefname{figure}{\textbf{Figure}}{\textbf{Figures}}
\Crefname{figure}{\textbf{Figure}}{\textbf{Figures}}

% BONUS
\crefname{table}{\textbf{Table}}{\textbf{Tables}}
\Crefname{table}{\textbf{Table}}{\textbf{Tables}}
\crefname{appendix}{\textbf{Annexe}}{\textbf{Annexes}}
\Crefname{appendix}{\textbf{Annexe}}{\textbf{Annexes}}
\crefname{section}{\textbf{\S}}{\textbf{\S}}
\Crefname{section}{\textbf{\S}}{\textbf{\S}}
\crefname{algorithm}{\textbf{Algorithme}}{\textbf{Algorithmes}}
\Crefname{algorithm}{\textbf{Algorithme}}{\textbf{Algorithmes}}


The answer by Fallino is almost right, but it allows only for either the types ("Figure", "Table", "Section"...), or the labels to be bold. Example:

In \cref{sectionname} we review the initial conditions ...


Leads to different output depending on the lines in the preamble.

Case 1

\usepackage[capitalize, nameinlink]{cleveref}
\crefdefaultlabelformat{#2\textbf{#1}#3}


results in:

Case 2

\usepackage[capitalize, nameinlink]{cleveref}
\crefname{section}{\textbf{Section}}{\textbf{Sections}}
\Crefname{section}{\textbf{Section}}{\textbf{Sections}}


results in:

Case 3

\usepackage[capitalize, nameinlink]{cleveref}
\crefdefaultlabelformat{#2\textbf{#1}#3} % <-- Only #1 in \textbf
\crefname{section}{\textbf{Section}}{\textbf{Sections}}
\Crefname{section}{\textbf{Section}}{\textbf{Sections}}


gives the desired look

• In general it's better to provide full examples, not just fragments of code. Please elaborate on your solution – Christian Hupfer Jul 13 '15 at 17:25