1

I have a problem with using the autoref

enter image description here

I want to change the format form 1a → Fig. 1(a)

What should I do?

Here is my code:

\documentclass[journal]{IEEEtran}  
\hyphenation{op-tical net-works semi-conduc-tor} \label{setting}  
\usepackage{graphicx}    
\usepackage{hyperref}  
\renewcommand{\figureautorefname}{Fig.}  
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}

\begin{document}  
    \begin{figure}[!t]  
        \centering  
        \subfloat[]{\includegraphics[width=2.5in]{A}\label{A}}  
        \\  
        \subfloat[]{\includegraphics[width=2.5in]{B}\label{B}}  
        \caption{LETTER }  
        \label{LETTER}  
    \end{figure}    

 The letter A is shown in \autoref{A}  
\end{document}

Thanks a lot !

3
  • (1) Welcome, (2) please extend your example to a full example so we know what document class you are using. Also isn't hyperref suppose to be loaded after subfig?
    – daleif
    Nov 13, 2019 at 14:38
  • I am so sorry I have not described my problem clearly. I have already re-edited it. Is this ok? Nov 14, 2019 at 0:46
  • The label for the subref should probably so inside the subfloat, often \subfloat[\label{...}]{...} is used
    – daleif
    Dec 15, 2019 at 14:57

1 Answer 1

0

Since A is a label to a sub-figure (and not to a figure), try \subfigureautorefname instead of \figureautorefname:

\documentclass[journal]{IEEEtran}
\hyphenation{op-tical net-works semi-conduc-tor}% \label{setting}
\usepackage[demo]{graphicx}
\usepackage{hyperref}
\newcommand{\subfigureautorefname}{Fig.}
\usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}

\begin{document}
    \begin{figure}[!t]
        \centering
        \subfloat[]{\includegraphics[width=2.5in]{A}\label{A}}
        \\
        \subfloat[]{\includegraphics[width=2.5in]{B}\label{B}}
        \caption{LETTER}
        \label{LETTER}
    \end{figure}

 The letter A is shown in \autoref{A}
\end{document}

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.