# Problem with subfig, autoref and renewcommand

I have a problem with using the autoref

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 !

• (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? 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 Dec 15, 2019 at 14:57

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}