\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\captionsetup[subfloat]{subrefformat=parens}
\usepackage{cleveref}
\crefname{figure}{\figurename}{\figurename}
\begin{document}
\begin{figure}
\centering
\subfloat[]{\includegraphics[width=.3\linewidth]{example-image-a}\label{aaa}}\hfil
\subfloat[]{\includegraphics[width=.3\linewidth]{example-image-b}\label{bbb}}
\caption{title}
\label{ccc}
\end{figure}
\figurename~\ref{aaa}
\figurename~\ref{bbb}
\figurename~\ref{ccc}
\figurename~\subref*{aaa}
\figurename~\subref*{bbb}
\cref{aaa}
\cref{bbb}
\cref{ccc}
\end{document}
我想使用\cref
子浮点标签来生成1(a)
,但是不行1a
。有什么简单的方法吗?
答案1
下列应该覆盖所有基地。
基本思想:重新定义\thesubfigure
为包含括号(假设您永远不会使用没有括号的格式),并修复其他所有内容以匹配。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{cleveref}
\crefname{figure}{\figurename}{\figurename}
\renewcommand\thesubfigure{(\alph{subfigure})}
\captionsetup{lofdepth=2}
\captionsetup[subfloat]{labelformat=simple,listofformat=subsimple,subrefformat=simple}
\begin{document}
\listoffigures
\begin{figure}
\centering
\subfloat[]{\includegraphics[width=.3\linewidth]{example-image-a}\label[subfigure]{aaa}}\hfil
\subfloat[]{\includegraphics[width=.3\linewidth]{example-image-b}\label[subfigure]{bbb}}
\caption{title}
\label{ccc}
\end{figure}
\figurename~\ref{aaa}
\figurename~\ref{bbb}
\figurename~\ref{ccc}
\figurename~\subref*{aaa}
\figurename~\subref*{bbb}
\figurename~\subref{aaa}
\figurename~\subref{bbb}
\cref{aaa}
\cref{bbb}
\cref{ccc}
\end{document}