0

In regard to these questions

customize of autoref and \autoref does not expand abbreviation automatically at beginning of line

I would like to know, how I can customize the pasting of additional brackets.

Example: Instead of showing enter image description here, Latex should display enter image description here when I use \autoref.

Minimal coding example:

\documentclass[journal,comsoc]{IEEEtran}
\usepackage[T1]{fontenc}% optional T1 font encoding
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{url}
\usepackage{enumitem}
\usepackage{setspace}
\usepackage{color,soul}
\usepackage{siunitx}
\usepackage{float}
\usepackage{subcaption}
\usepackage{cleveref}
\usepackage{hyperref}
\interdisplaylinepenalty=2500

\usepackage[cmintegrals]{newtxmath}

\begin{document}

\begin{figure}[htbp!]

    \centering

    \begin{subfigure}{0.2\textwidth}
        \includegraphics[width=\textwidth]{Pictures1}
        \caption{Nice image1}
        \label{fig:NiceImage1}
    \end{subfigure}
    \hfill
    \begin{subfigure}{0.2\textwidth}
        \includegraphics[width=\textwidth]{Pictures2}
        \caption{Nice image 2}
        \label{fig:NiceImage2}
    \end{subfigure}

    \caption{Two images}

    \label{fig:NiceImage}

\end{figure}


\autoref{fig:NiceImage1}
% Latex should display and reference to Figure 1(a)


\end{document}

I am sorry, if this is a duplicate of an already answered question!

Mico
  • 506,678
Daniel
  • 3

1 Answers1

2

From the subcaption documentation, page 9:

If you want parentheses around the sub-figure part of the reference, so they will look like ‘1(a)’, you may get them this way:

\usepackage[labelformat=simple]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}
\documentclass[journal,comsoc]{IEEEtran}
\usepackage[T1]{fontenc}% optional T1 font encoding
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{url}
\usepackage{enumitem}
\usepackage{setspace}
\usepackage{color,soul}
\usepackage{siunitx}
\usepackage{float}
\usepackage[labelformat=simple]{subcaption}
\usepackage{hyperref}
\usepackage{cleveref}
\interdisplaylinepenalty=2500

\usepackage[cmintegrals]{newtxmath}

\renewcommand\thesubfigure{(\alph{subfigure})}

\begin{document}

\begin{figure}[htbp!]

    \centering

    \begin{subfigure}{0.2\textwidth}
        \includegraphics[width=\textwidth]{example-image}
        \caption{Nice image1}
        \label{fig:NiceImage1}
    \end{subfigure}
    \hfill
    \begin{subfigure}{0.2\textwidth}
        \includegraphics[width=\textwidth]{example-image}
        \caption{Nice image 2}
        \label{fig:NiceImage2}
    \end{subfigure}

    \caption{Two images}

    \label{fig:NiceImage}

\end{figure}


\autoref{fig:NiceImage1}
% Latex should display and re


\end{document}

enter image description here