[Tex/LaTex] Autoref’s inserted text has not the correct case

capitalizationcross-referencinghyperrefnaming

I'm using the \autoref tag which comes with the package hyperref for referencing my algorithms, figures etc. I read that it automatically adjusts the reference text's case, but it won't work with my setup. When I compile the code, everything (page, text, link) is correctly put, except the case like in the following example:

As it can be seen in Figure 9.7, this […]

Remark: there may be something wrong with my setup – links to text sections (like chapter, section, subsection) and also floating environments like "algorithm" (algorithm2e.sty) do have the correct case. The case is wrong when refering to Figures and Equations.

Best Answer

hyperref.sty indeed includes the following code snippet (with names sometimes, but not always in uppercase):

\def\HyLang@english{%
  \def\equationautorefname{Equation}%
  \def\footnoteautorefname{footnote}%
  \def\itemautorefname{item}%
  \def\figureautorefname{Figure}%
  \def\tableautorefname{Table}%
  \def\partautorefname{Part}%
  \def\appendixautorefname{Appendix}%
  \def\chapterautorefname{chapter}%
  \def\sectionautorefname{section}%
  \def\subsectionautorefname{subsection}%
  \def\subsubsectionautorefname{subsubsection}%
  \def\paragraphautorefname{paragraph}%
  \def\subparagraphautorefname{subparagraph}%
  \def\FancyVerbLineautorefname{line}%
  \def\theoremautorefname{Theorem}%
  \def\pageautorefname{page}%
}

Solution: Redefine the "offending" name macros.

\documentclass{article}

\usepackage{hyperref}

\renewcommand*{\figureautorefname}{figure}

\begin{document}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{foo}\label{fig:foo}
\end{figure}

As shown in \autoref{fig:foo}~\dots

\end{document}

enter image description here

Related Question