我有一个基于回忆录类的大型文档,并与其子图基础结构紧密集成 - 例如,添加像subfloat
/ subfig
/这样的包subcaption
是极其不可取的(据我所知,可以使用副标题)。
出版商突然要求我把所有的子图和它们的参考标签做成这样: 即,副标题仅由斜体字母组成,并且文本中的参考文献用逗号和空格将该字母与图形编号分隔开。
我能想到的最好的办法就是重新定义thesubfigure
,但它会弄乱子标题。
我阅读了 cleveref 文档,确信有一些钩子可以定义如何呈现文内引用标签,但却找不到任何东西。
梅威瑟:
\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}
答案1
按照您上次注释掉的文字,是否有类似的内容?
We can seen the A image in~\cref{img:images},~\subcaptionref{img:image-a};
the B image in~\cref{img:images},~\subcaptionref{img:image-b};
and both images in~\cref{img:images}.