General\autoref and \chaptername

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
n070161
Posts: 10
Joined: Fri Aug 27, 2010 11:16 pm

\autoref and \chaptername

Post by n070161 »

*SOLVED*

Hello,

I changed the \chaptername command for getting "Capítulo" rather than "Chapter", but when I label a chapter (by \label{chap:1}, for example) and then reference it (by \autoref{chap:1}) I get a link which says "chapter 1" and not "Capítulo 1". Anybody knows how to fix that problem?

Thank you
Last edited by n070161 on Fri Sep 03, 2010 4:08 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

\autoref and \chaptername

Post by gmedina »

Hi,

there's no need to redefine \chaptername; simply load babel with the spanish option:

Code: Select all

\documentclass{book}
\usepackage[spanish]{babel}
\usepackage{hyperref}

\begin{document}

\chapter{Primer cap\'itulo}\label{cap:uno}

\autoref{cap:uno}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
n070161
Posts: 10
Joined: Fri Aug 27, 2010 11:16 pm

Re: \autoref and \chaptername

Post by n070161 »

Thank you

Nevertheless, it's not the first time I'm having this problem, and not always trying to call them "Capítulo(s)" (sometimes "Tema(s)", for example), so I still would like to know how to do it :P
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

\autoref and \chaptername

Post by gmedina »

n070161 wrote:...Nevertheless, it's not the first time I'm having this problem, and not always trying to call them "Capítulo(s)" (sometimes "Tema(s)", for example), so I still would like to know how to do it...
Without using babel you'll have to redefine the corresponding command and its "autoref" variant:

Code: Select all

\documentclass{book}
\usepackage{hyperref}

\renewcommand\chaptername{Tema}
\renewcommand\chapterautorefname{Tema}

\begin{document}

\chapter{Primer tema}\label{cap:uno}

\autoref{cap:uno}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
n070161
Posts: 10
Joined: Fri Aug 27, 2010 11:16 pm

Re: \autoref and \chaptername

Post by n070161 »

Thank you!

that's just what I've been looking for.
Post Reply