# How to add '( )' to the figure reference?

I have a figure that has three subfigures and I want to \ref them. I need them in this following format:

Fig. 1(a)

But when I use the \ref with the label of the subfigure a, it references this way:

Fig. 1a

I'm using the package \subcaption.

Can anyone help me with this problem?

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Oct 29 '18 at 16:02
• Maybe the following question can help you: Changing the formatting of subcaption for reference – leandriis Oct 29 '18 at 16:31
• I would use this format? \usepackage[labelformat=simple]{subcaption} \renewcommand\thesubfigure{(\alph{subfigure})} – Codewraith Oct 29 '18 at 16:39

\documentclass{book}

\usepackage[labelformat=simple]{subcaption}
\usepackage{graphicx}

\renewcommand\thesubfigure{(\alph{subfigure})}

\begin{document}

Fig.\ \ref{coffee1}

\section{Introduction}

\begin{figure}[h!]
\centering
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{example-image}
\caption{One cup of coffee.}
\label{coffee1}
\end{subfigure}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{example-image}
\caption{fig:More coffee.}
\label{fig:coffee2}
\end{subfigure}
\caption{Coffee.}
\label{fig:types_of_coffee}
\end{figure}

\end{document}


• @Codewraith My pleasure! – daniel Oct 29 '18 at 17:16