add tag
mk9y
In a book I'm writing, I previously used the package **subfig**, which works with **cleveref**, but is inflexible and orphaned. I'm trying to move to the **subcaption** package, which is flexible, but the cross-references are not working. Can anyone provide a way to use **cleveref** with **subcaption**?
Top Answer
Skillmon
You can use the `\subref` command to reference a sub-caption:

```
\documentclass{article}

\usepackage{graphicx}
\usepackage[subfigure]{subcaption}
\usepackage{cleveref}

\usepackage{duckuments}% just to get different ducks

\begin{document}
\begin{figure}
  \centering
  \caption{Pictures of ducks\label{fig:ducks}}
  \subcaptionbox
    {A most lovely duck!\label{fig:lovely}}{\includegraphics{example-image-duck}}
  \subcaptionbox
    {Another duck.\label{fig:other}}{\includegraphics{example-image-duck}}
\end{figure}

And in \Cref{fig:ducks} we see different ducks. The one in
\Cref{fig:ducks}\subref{fig:lovely} is especially lovely, don't you think?
\end{document}
```

gives:

![cleversubref.png](/image?hash=01a2caa8744be0a2b1593a21c8d036a85b35e1182feddd994a3e46fcb61d2515)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.