2

I am using the package \subcaption; I would like my subfigures to be labeled by letters, e.g. (a), and when referencing a subfigure with \ref I would like to get something like Fig. 1(a). By default, subfigures are indeed labelled by (a) but \ref produces e.g. 1a. Following the manual by Axel Sommerfeldt, I tried including the line

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

With this, \ref returns the output that I would like e.g. 1(a), but subfigures are now labelled by double brackets such as ((a)). Here's a minimal working example reproducing the double brackets:

\documentclass[twocolumn,pra,amsmath,amssymb,floatfix,superscriptaddress,nofootinbib,showpacs]{revtex4-1}
\usepackage{amsmath,amssymb,graphicx,epsfig}

\usepackage[font=footnotesize]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}

\begin{document}
Here's a block of code

\begin{figure}
\centering
     \begin{subfigure}[b]{0.41\linewidth}
         \caption{}
         \label{fig:subfigure}
     \end{subfigure}
  \caption{Figure caption}
\label{fig:fullFigure}
\end{figure}

I want to reference Fig.~\ref{fig:fullFigure} and in particular Fig.~\ref{fig:subfigure}.

\end{document}
2

By default, subcaption loads the parens label format. As a result, you have double parentheses in subcaptions. You can add labelformat=simple to specify the simple label format and get the desired output. In your case:

\usepackage[font=footnotesize,labelformat=simple]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}

enter image description here

| improve this answer | |
0

You just have use \cref or \Cref from the cleveref package, according to whether you want or not an capital F. Note this package has to be loaded after hyperref.

Also, note that you don't have to use parentheses in redefining the subfigure labels: the subcaption package already adds them (unless you want a double pair of parentheses…).

You don't have to load epsfig: it is a wrapper to a compatibility mode for old documents. Internally, it is graphics which does the job.

\documentclass[twocolumn,pra,amsmath,amssymb,floatfix,superscriptaddress,nofootinbib,showpacs]{revtex4-1}
\usepackage{amsmath, amssymb, graphicx}

\usepackage[font=footnotesize]{subcaption}
\renewcommand\thesubfigure{\alph{subfigure}}
\usepackage{cleveref}

\begin{document}

Here's a block of code

\begin{figure}
\centering
     \begin{subfigure}[b]{0.41\linewidth}
         \caption{}
         \label{fig:subfigure}
     \end{subfigure}
  \caption{Figure caption}
\label{fig:fullFigure}
\end{figure}

I want to reference \Cref{fig:fullFigure} and in particular \cref{fig:subfigure}.

\end{document}

enter image description here

| improve this answer | |

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.