[Tex/LaTex] \autoref showing subsection and subsubsection

hyperrefsectioning

I'm using the \autoref command from the hyperref package. I have the following code:

\subsection{Foo}
\label{ssec:bar}
This is the overview.

\subsubsection{Bar}
\label{sssec:bar}
This is the small part.

Later in the text, we refer to `\autoref{ssec:foo}` and `\autoref{sssec:bar}`.

After compiling, this shows the following text:

I.A. Foo

This is the overview.

I.A.1. Bar

This is the small part.

Later in the text, we refer to subsection I.A. and subsubsection
I.A.1.

The problem I have with this is that \autoref is showing "subsection" and "subsubsection", when I'd rather it just show "section". Is there any way to override this in the hyperref package so it doesn't put any of the "subs" in there?

Best Answer

The names are stored in macros <counter>autorefname. The following examples redefines them using the same meaning as \sectionautorefname:

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\renewcommand*{\thesection}{\Roman{section}}
\renewcommand*{\thesubsection}{\thesection.\Alph{subsection}}

\let\subsectionautorefname\sectionautorefname
\let\subsubsectionautorefname\sectionautorefname

\begin{document}
\section{Section}
\subsection{Foo}
\label{ssec:foo}
This is the overview.

\subsubsection{Bar}
\label{sssec:bar}
This is the small part.

Later in the text, we refer to \autoref{ssec:foo} and \autoref{sssec:bar}.
\end{document}

Result