I have a giant document based on memoir class and tightly integrated with its subfigure infrastructure - i.e. adding packages like subfloat
/subfig
/subcaption
is extremely undesirable (AFAIK it’s possible to solve my problem with subcaption).
The publisher SUDDENLY demanded me to make all subfigures and their reference labels to look like this:
i.e. subcaptions consist of an italicized letter only, and the reference inside text has said letter separated from the figure’s number with a comma and a space.
The best I could come up with is to redefine thesubfigure
, but it messes up the subcaptions.
I read the cleveref documentation, being sure that there is some hook to define how the in-text reference label is rendered, but couldn't find anything.
MWE:
\documentclass[a4paper,14pt]{memoir}
\usepackage{graphicx}
\usepackage{cleveref}
\newcommand{\SCFigFont}{\small}
\newcommand{\SCFigLabelFont}{\SCFigFont\itshape}
% Figure settings - just in case some of the solutions you might want to offer conflict with these
\setfloatadjustment{figure}{
\renewcommand{\figurename}{Fig.} % changed for simplicity
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{0pt}
\captionnamefont{\SCFigLabelFont}
\captiontitlefont{\SCFigFont}
\captiondelim{. }
\captionstyle[\centering]{\centerlastline}
\SCFigFont % turn on the needed font for everything that happens to be in the figure
\renewcommand{\baselinestretch}{1} % ditto for line spacing
}
% Subfigure settings
\newsubfloat{figure}
\subcaptionstyle{\centering}
\subcaptionsize{\SCFigFont}
\subcaptionlabelfont{\SCFigLabelFont}
\subcaptionfont{\SCFigFont}
\tightsubcaptions
% The closest thing to a solution that I could find
\renewcommand{\thesubfigure}{,~\itshape\alph{subfigure}}
%\renewcommand{\thesubfigure}{\alph{subfigure}}
\begin{document}
\chapter{Chapter name}
\begin{figure}[ht]
{\centering
\hfill
\subbottom[\label{img:image-a}]{%
\includegraphics[width=0.4\linewidth]{example-image-a}}
\hfill
\subbottom[\label{img:image-b}]{%
\includegraphics[width=0.4\linewidth]{example-image-b}}
\hfill
}
\caption{Example images: \subcaptionref{img:image-a} --- image A; \subcaptionref{img:image-b} --- image B}
\label{img:images}
\end{figure}
We can see the A image in~\cref{img:image-a};
the B image in~\cref{img:image-b};
and both images in~\cref{img:images}.
%We can see the A image in~\cref{img:images},~\textit{a};
%the B image in~\cref{img:images},~\textit{b};
%and both images in~\cref{img:images}.
\end{document}