17

I'm trying to change the name the function \autoref (from the hyperref package) uses for chapters. By default it outputs "chapter X" (lower case c) but I want it to output "Chapter X" (upper case c). In my document I can successfully redefine the \chapterautorefname function to something else without generating warnings or errors, but the value I assign to it seems to be ignored. I've also tried normally defining it (which nicely gives an already defined error) and redefining \Chapterautorefname (which generated a nice, not yet defined error).

Minimal working example

\documentclass[12pt, a4paper, openany]{report}
\usepackage[english]{babel}         
\usepackage[utf8]{inputenc}         
\usepackage{hyperref}               

\renewcommand{\chapterautorefname}{Something}

% Document
\begin{document}
\chapter{One}
In \autoref{chap:two}...

\chapter{Two}
\label{chap:two}

\end{document}

Generated output:

Output

18

Package babel supports many languages, therefore you have to put the redefinition into \extrasenglish:

\documentclass[12pt, a4paper, openany]{report}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[colorlinks]{hyperref}

\addto\extrasenglish{%
  \renewcommand{\chapterautorefname}{Chapter}%
}

\begin{document}
\chapter{One}
In \autoref{chap:two}...

\chapter{Two}
\label{chap:two}
\end{document}

Result

It is also explained in the manual of hyperref.

  • I went through the manual again but babel isn't even mentioned in support for other packages so I'm not sure where you got your info. But anyway, this works :). – Roy T. Jun 27 '14 at 15:14
  • 1
    @RoyT.: The example in the manual is: \usepackage[ngerman]{babel}\addto\extrasngerman{\def\subsectionautorefname{Unterkapitel}}. It can be found at the place, where \autoref is explained. – Heiko Oberdiek Jun 27 '14 at 20:27

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.