# Subfigures. To add A and B to subfigures (in the top left corner), and to label them for referencing

I'm trying to set up a figure, so that it contains 2 subfigures. I would prefer if I could set them up with an A and B in the left-top corner (outside of the figure). However, I would also want to be able to reference each subfigure in my text. I have searched for a lot of different solutions, but I haven't been able to put together anything that works, so I'll try with a question.

Here's my MWE:

\documentclass[a4paper,11pt]{book}
\usepackage{subcaption}
\usepackage{cleveref}

\begin{document}
\begin{figure}[tb]
\centering

\begin{subfigure}[t]{0.03\textwidth}
\textbf{A}
\end{subfigure}
\begin{subfigure}[t]{0.45\textwidth}
\includegraphics[width=\linewidth,valign=t]{"test1"}
\label{subfigure1}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.03\textwidth}
\textbf{B}
\end{subfigure}
\begin{subfigure}[t]{0.45\textwidth}
\includegraphics[width=\linewidth,valign=t]{"test1"}
\label{subfigure2}
\end{subfigure}

\caption{Here's a nice caption}. \label{overall label}
\end{figure}

Me trying to reference the entire figure: Figure \ref{overall label}.
Me trying to reference the first subfigure A: Figure \cref{subfigure1}.
Me trying to reference the first subfigure B: Figure \cref{subfigure2}.
\end{document}


It looks something like this

I think I've got the part covered with the letters (even though I have to manually assign the letters). However, I can not get the subfigure reference to work.

I'm sorry if it seems messy. I'm not particularly adept with LaTeX. I hope someone will be able to help out!

I suspect that you like to have something like this:

\documentclass{article}
\usepackage{floatrow}
\usepackage{graphicx}
%\usepackage{subfig}
\usepackage[label font=bf,labelformat=simple]{subfig}% <-- changed
\usepackage{caption}
\floatsetup[figure]{style=plain,subcapbesideposition=top}

\begin{document}
\begin{figure}[htb]\centering
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image-a}\label{fig:a}}
\hfil
\sidesubfloat[]{\includegraphics[width=0.4\textwidth]{example-image-b}\label{fig:b}}
\caption{Main caption}
\label{fig:myfigure}
\end{figure}
Figure \ref{fig:myfigure} consist three sub figures: \ref{fig:a} and \ref{fig:b}
\end{document}


Addendum: Sub captuion layout you can determine by subfig options. They are summarized in subfig documentation, page 8. If you replace

\usepackage{subfig}


with

\usepackage[label font=bf,labelformat=simple]{subfig}


than subcaptions will look as show new image.

• Excellent answer! It solves many of my problems. I, however, have a new one: Will it be possible to change the labeling of my subfigures from (a) and (b) to a bold-fontet A and B? And also make this appear in my text when I reference them? So it says "Figure 1 consists three subfigures: 1A and 1B"? – Andreas Redsted May 17 '16 at 16:15
• well, this is additional/new question ... :-). of course, it is possible. See subfig documentations for options which it offer. I can do this latter evening. – Zarko May 17 '16 at 16:17
• That would be much appreciated! I have checked the documentations for both floatrow and subfig, I now know how to make the captions bold, but not how to get rid of the parenthesis and make it capital letters. – Andreas Redsted May 17 '16 at 17:07
• The \usepackage[label font=bf,labelformat=simple]{subfig} did the trig, I will upgrade my answer. – Zarko May 17 '16 at 17:15
• Is there any way to adjust the size of the letters a and b, while maintaining the bold font? – Andreas Redsted May 17 '16 at 18:11