2

When I use \autoref{}, from the hyperref package, to cross reference a \chapter{}, the cross-reference in the text is not capitalized. How can I change this?

\documentclass{report}

\usepackage{hyperref}

\begin{document}

\chapter{Intro}\label{int}
HE First \autoref{int}
\chapter{Next One}

\end{document}

enter image description here

marked as duplicate by Mensch, marmot, Zarko, Stefan Pinnow, TeXnician Jan 8 '18 at 5:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You can't this way, but look at the cleveref package and it's \Cref macro – user31729 Dec 7 '17 at 4:09
  • @iled That question is specifically about cross-references in listings environments. How does that apply here? – cfr Jan 8 '18 at 3:59
  • @cfr because that other one is an XY problem. All the answers there also apply here. One may argue then the other question should be reworded. – iled Jan 8 '18 at 7:01
  • @iled But it is questions which are duplicates or not - not answers. – cfr Jan 8 '18 at 18:26
  • 1
    @cfr I understand your point and agree with you. However, the community voted and I believe I can't do anything now. – iled Jan 9 '18 at 0:28
7

The quickest way is to change the information for \autoref which is stored in a macro named \chapterautorefname, defaulting to chapter by redefinition into being Chapter then.

Please note that any defined autoref information is stored in \Xautorefname, where X is the name of the underlying counter, e.g chapter, part etc.

A more flexible way is to use \usepackage{cleveref} after loading hyperref and replace \autoref{int} by \Cref{int}.

\documentclass{report}

\usepackage{hyperref}

\renewcommand{\chapterautorefname}{Chapter}

\begin{document}

\chapter{Intro}\label{int}
HE First \autoref{int}
\chapter{Next One}

\end{document}

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.