2

I want to add ( ) parenthesis in subfigure references when using \cref.

\documentclass{article}

\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage[capitalize]{cleveref}

\begin{document}

\begin{figure}[h]
\begin{subfigure}{.40\linewidth}
\includegraphics{1.eps}
\caption{Sample}
\label{Fig:sama}
\end{subfigure}\phantom{aa}
\begin{subfigure}{.40\linewidth}
\includegraphics{2.eps}
\caption{Sample}
\label{Fig:samb}
\end{subfigure}
\caption{Sample Subfigure}
\label{Fig:sam}
\end{figure}

This is a reference \cref{Fig:sama,Fig:samb}

\end{document}

OUTPUT

enter image description here

Required output:

This is a reference Figs. 1(a) and 1(b)

Mico
  • 506,678

1 Answers1

2

You need to provide the instructions

\captionsetup[subfigure]{labelformat=simple} % default label format is 'parens'
\renewcommand\thesubfigure{(\alph{subfigure})}

after loading the subcaption package. See also How to change subcaption numbering?


A full MWE and associated screenshot:

enter image description here

\documentclass{article}

\usepackage[demo]{graphicx}
\usepackage{subcaption}
\captionsetup[subfigure]{labelformat=simple} % default is 'parens'
\renewcommand\thesubfigure{(\alph{subfigure})}
\usepackage[capitalize]{cleveref}

\begin{document}

\begin{figure}[ht!]
\begin{subfigure}{.45\linewidth}
    \includegraphics{1.eps}
    \caption{Sample A}
    \label{Fig:sama}
\end{subfigure}\hfill
\begin{subfigure}{.45\linewidth}
    \includegraphics{2.eps}
    \caption{Sample B}
    \label{Fig:samb}
\end{subfigure}
\caption{Sample figure with two subfigures}
\label{Fig:sam}
\end{figure}

This is a cross-reference to \cref{Fig:sama,Fig:samb}.
\end{document}
Mico
  • 506,678
  • THank you is there any possibilities to remove the parenthesis in some occurences – New to latex Feb 10 '20 at 12:25
  • @Newtolatex - I'm afraid I'm not aware of such a possibility. Moreover, given that the subfigure "numbers" are given by (a), (b), etc., your readers may be confused if they're cross-referenced elsewhere in the document as a, b, etc. – Mico Feb 10 '20 at 12:43