I am new here, and also new to LaTeX, so apologies if I have included too much or too little!
I have been using the subfig
package, and just today added in cleveref
.
The subfig package labels my subfigures (a), (b) etc, and I have been using the \subref
command to make the same appear in the text.
However, using \cref
(or even \ref
) in the text to refer to the figure number as well as subfigure letter, there are no parentheses. I would like my output to appear
figure 2(a)
But instead it appears
figure 2a
I have been searching a while online, but I can't see how to do this. I see here that someone has had the opposite problem and needed to get rid of unwanted parentheses. I can't work out what I have done relative to what he's doing other than that I am using subfig.
Thanks in advance!
Here's my code (more or less)
\documentclass{article}
\usepackage{graphicx} % needed for including graphics e.g. EPS, PS
\usepackage{epstopdf} % automatic conversion
\usepackage{grffile} % allow fullstops in graphics file names
\usepackage[format=hang,singlelinecheck=0,font={sf,small},labelfont=bf]{caption, subfig}
% allow subfigures
\usepackage[noabbrev]{cleveref} % reference object types automatically
\graphicspath{{figures/}}
\begin{document}
Here is some text and a figure
\begin{figure}
\begin{minipage}[tbh]{\linewidth}
\centering
\captionsetup{justification=raggedright}
\subfloat[text]{\label{fig:1a}\includegraphics{file1.eps}}\qquad
\subfloat[text]{\label{fig:1b}\includegraphics{file2.eps}}\qquad
\subfloat[text]{\label{fig:1c}\includegraphics{file3.eps}}\qquad
\subfloat[text]{\label{fig:1d}\includegraphics{file4.eps}}\qquad
\end{minipage}
\caption{\subref{fig:1a} to \subref{fig:1b} are plotted against height, and \subref{fig:1c} to \subref{fig:1d} against pressure}
\label{fig:1}
\end{figure}
Now I'd like to refer to the figure \ref{fig:1d}. And use cref: \cref{fig:1d}
\end{document}