I am writing a document using the memoir
class. I would like to create a figure with two subfigures and to display a caption like "Plot of Y vs X with z=1 (a) and with z=2 (b)", where "(a)" and "(b)" are references to the subfigures.
I read How to reference subfigure in caption and Customize referencing of subcaptions in “memoir”?. The following example based on Werner's code solve my problem.
\documentclass{memoir}
\newsubfloat{figure}
\usepackage[demo]{graphicx}
\usepackage{xstring}
\usepackage{xspace}
\newcommand*{\subfigref}[1]{(\StrBetween{\ref{#1}}{(}{)})\xspace}%
\begin{document}
\begin{figure}[ht]
\centering
\subbottom[This is a subfigure\label{fig:label:a}]{\includegraphics{figure1}} \qquad
\subbottom[This is a subfigure\label{fig:label:b}]{\includegraphics{figure2}}
\caption{These are some awesome figures: \protect\subfigref{fig:label:a} and \protect\subfigref{fig:label:b} }
\label{fig:label1}
\end{figure}
\end{document}
How can I make the previous example work with hyperref
? In Customize referencing of subcaptions in “memoir”?, egreg seems to know how to do this but I do not understand enough his answer to use it for this particular problem.
EDIT
Note that I would also like to keep references such as "in Figure 0.1(a)" outside the figure.