Fixing Subfloat Image Labels in LaTeX Captions

  • LaTeX
  • Thread starter ehrenfest
  • Start date
  • Tags
    Image Latex
In summary, the conversation is about using the subfloat package to label images in a figure, but encountering an issue where the reference appears as "1a" instead of just "a" in the caption. The solution is to use \subref instead of \ref when labeling the images.
  • #1
ehrenfest
2,020
1
Hello,

I am using the subfloat package. I have several images in my figure and I wanted to have an (a), (b), (c) under them and then refer to them like that in the caption. However, when I do ref {image1a} in the caption it shows up as "1a" instead of "a". I don't want the "1" because this is the caption for figure 1. Is there any way to get rid of that?

Does this make sense?

Thanks.
 
Last edited:
Physics news on Phys.org
  • #3
I want to something like this

Code:
\begin{figure}
  \centering
  \subfloat[A gull]{\label{fig:gull}\includegraphics[width=0.3\textwidth]{gull}}                
  \subfloat[A tiger]{\label{fig:tiger}\includegraphics[width=0.3\textwidth]{tiger}}
  \subfloat[A mouse]{\label{fig:mouse}\includegraphics[width=0.3\textwidth]{mouse}}
  \caption{Here we a gull \ref{fig:gull} and a tiger \ref{fig:tiger} and a mouse \ref{fig:mouse}}
  \label{fig:animals}
\end{figure}

except I want it to say (a) instead of (1a) where I put \ref{fig:gull}.
 
  • #4
use \subref{reflabel} rather than \ref{...}
 

1. How do I fix subfloat image labels in LaTeX captions?

To fix subfloat image labels in LaTeX captions, you can use the \subcaption package and the \subcaptionbox command. This allows you to specify the label for each subfigure separately and avoid conflicts with other labels in your document.

2. Can I use custom labels for my subfloat images?

Yes, you can use custom labels for your subfloat images by using the \label command within the \subcaptionbox command. This will assign a unique label to each subfigure, which you can then refer to in your captions or cross-referencing.

3. How can I change the numbering format for my subfloat images?

You can change the numbering format for your subfloat images by using the \renewcommand{\thesubfigure}{...} command. This allows you to customize the numbering style, such as using letters instead of numbers, for your subfigures.

4. Is there a way to adjust the spacing between subfloat images in a LaTeX caption?

Yes, you can adjust the spacing between subfloat images in a LaTeX caption by using the \hspace{...} command within the \subcaptionbox command. This allows you to manually adjust the horizontal spacing between subfigures in your caption.

5. Can I use subfloat images in a figure environment without using the \subcaption package?

Yes, you can use subfloat images in a figure environment without using the \subcaption package by using the \captionbox command instead of \subcaptionbox. However, this will not allow you to specify individual labels for each subfigure and may result in conflicts with other labels in your document.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
940
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
11K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
11K
Back
Top