我正在使用cleveref
withcrefmultiformat
来引用子图列表。我希望将引用主图子图的字母列在括号内,如下所示:图 1(a,b)
我使用以下代码得到的输出是:图 1a(,b)
如何实现呢?
\documentclass[11pt,
twoside,
a4paper,
english,
abstract=off,
headsepline=on,
captions=tableheading]
{scrartcl}
\usepackage[]{graphicx}
\usepackage[colorlinks]{hyperref}
\usepackage{xstring}
\usepackage{subcaption}
\usepackage{cleveref}
\crefmultiformat{figure}
{figs.~#2#1\xdef\mycreffirstarg{#1}(#3}
{,#2{\crefstripprefix{\mycreffirstarg}{#1}}#3)}
{,#2{\crefstripprefix{\mycreffirstarg}{#1}}#3}
{,#2{\crefstripprefix{\mycreffirstarg}{#1}}#3)}
\begin{document}
\begin{figure}[h]
\centering
{\phantomsubcaption\ignorespaces\label{subfig:fig-a}}
{\phantomsubcaption\ignorespaces\label{subfig:fig-b}}
\includegraphics[width=0.5\textwidth]{example-image-a}
\caption{Example}
\label{fig:fig}
\end{figure}
The output that I would like to get is: figs. 1(a,b)
The output that I get is: \cref{subfig:fig-a,subfig:fig-b}
\end{document}