1

I am using the subfig package to display two plots using the code below:

\begin{figure}[!ht]
 \subfloat[Singular 
Terms\label{secondring:subfig-1}]{%
   \includegraphics[width=0.4\textwidth] 
{ring2branch124lowlim.pdf}
              }
 \hfill
 \subfloat[Analytic 
 Terms\label{secondring:subfig-2}]{%
   \includegraphics[width=0.4\textwidth] 
 {ring2branch124highlim.pdf}
 }
     \\
     \hfill
 \caption{Root Test Results for $\{1,2,4\}$ 
  branch in Second Annular Region}
 \label{figure:secondring}
 \end{figure}

and the figures display with captions: (A) Analytic Terms and (B) Singular Terms.

However when I reference the sub figures using for example:

 \ref{secondring:subfig-1}

the reference shows up as lower case like 6a and not 6A.

Can someone help me get the reference to agree with the actual sub fig label format?

  • 2
    it is always best to produce a small but complete document that shows the problem (you can use example-image as the image so people can run the document) the problem will be in code not shown, where you set up counters. – David Carlisle Jun 19 '19 at 13:40
2

With the subfig package, the default numbering system for subfigure items uses lowercase alphabetic characters, e.g., (a), (b), etc. In contrast, your document appears to use (A), (B), etc to "number" consecutive subfigure items within a given figure. Put differently, your document must contain some subfig-relevant code that you didn't mention in your query.

A remedy would be to get rid of this special code and, instead, to insert the instruction

\AtBeginDocument{\renewcommand\thesubfigure{\Alph{subfigure}}}

somewhere in the preamble, after loading the subfig package.

enter image description here

\documentclass[draft]{article} % omit 'draft' option in real document
\usepackage{graphicx,subfig}
\AtBeginDocument{\renewcommand\thesubfigure{\Alph{subfigure}}} % <-- new

\usepackage{cleveref} % package to generate "clever" cross-reference call-outs.
\crefname{subfigure}{subfigure}{subfigures}

\begin{document}
\setcounter{figure}{5} % just for this example

\begin{figure}[!ht]
\subfloat[Singular Terms\label{secondring:subfig-1}]{%
     \includegraphics[width=0.4\textwidth]
     {ring2branch124lowlim.pdf}}
 \hfill
\subfloat[Analytic Terms\label{secondring:subfig-2}]{%
     \includegraphics[width=0.4\textwidth] 
     {ring2branch124highlim.pdf}}
\caption{Root Test Results for $\{1,2,4\}$ branch in Second Annular Region}
\label{figure:secondring}
\end{figure}

\noindent
Cross-references to \cref{secondring:subfig-1,secondring:subfig-2}.  
\end{document}
| improve this answer | |
  • 1
    Thank you. The AtBeginDocument command solved the problem. Very thorough. Also led me to cref and cleveref which looks interesting. – Dominic Jun 19 '19 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.