[Tex/LaTex] Adding parentheses around subfig references

cross-referencingformattingsubfloats

Say I have a figure with two subfloats inserted using the subfig package. When I reference them with \ref{myLabel} I get this

Figure 3.5a and 3.5b.

But what I want is this:

Figure 3.5(a) and 3.5(b).

How can I add the parentheses?

Best Answer

For the subfig package see sections 2.2.2 and 3 of the documentation.

\documentclass{article}
\usepackage[subrefformat=parens,labelformat=parens]{subfig}

\begin{document}
See Figure~\subref*{sf1} for more information.
\begin{figure}
\centering
\subfloat[Subfig 1]{\label{sf1} Contents of the sub-figure}
\qquad
\subfloat[Subfig 2]{\label{sf2} Contents of the sub-figure}
\caption{A figure}
\label{fig}
\end{figure}
\end{document}

Subfigures with parentheses


(Original answer)
Assuming you're using the subfloat package, section 4 of its documentation indicates you can do something like:

\renewcommand*\thesubfloatfigure{\themainfigure(\alph{subfloatfigure})}

to put the sub-number in parentheses.