0

I am trying to renew autoref caption titles when using the polyglossia package. Newer versions should, according to the manual, support the \addto command similar to Babel. However, I am unable to get it to work as the following MWE illustrates.

\documentclass{article}

\usepackage{hyperref}
\usepackage{etoolbox}
\usepackage{polyglossia}
\setmainlanguage[variant=american]{english}

%\usepackage[american]{babel}

\makeatletter
 \addto\extrasamerican{
\renewcommand*{\sectionautorefname}{Section}    }
\makeatother

\begin{document}
\section{Test}\label{sec:test}
Autoref to \autoref{sec:test} for a test.
\end{document}
1

The command to append to in this case is \blockextras@english, not \extrasamerican:

\documentclass{article}

\usepackage{polyglossia}
\usepackage{hyperref}

\setdefaultlanguage[variant=american]{english}

\makeatletter
\appto{\blockextras@english}{%
  \renewcommand*{\sectionautorefname}{Section}%
}
\makeatother

\begin{document}

\section{Test}\label{sec:test}
Autoref to \autoref{sec:test} for a test.

\end{document}

Besides, if you don't plan to use \autoref with other languages, you can place the \renewcommand outside the \appto altogether.

  • I just see that you changed your answer from \appto{\captionsenglish}to \blockextras@english. What's the difference? – Jörg Mar 6 '12 at 14:43
  • @Jörg: @egreg suggested that it is a more proper way semantically. Note that there is also a similar \inlineextras@english which will work inside \foreignlanguage or otherlanguage*. – Andrey Vihrov Mar 6 '12 at 14:46

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.