2

I want do redefine Section and Subsection in autoref names the same way

\renewcommand\chaptername{NewChapterName}
\renewcommand\chapterautorefname{NewChapterName}

do with Chapter names.

How do I do that?

2 Answers 2

6

I am not sure, if I understand what you want to do (there is no MWE in the question).

Assuming you are loading package hyperref:

\documentclass{report}
\usepackage[english]{babel}
\usepackage{hyperref}
\addto\captionsenglish{%
  \def\chaptername{NewChapterName}%
  \def\sectionname{NewSectionName}%
  \def\subsectionname{NewSubsectionName}%
}
\addto\extrasenglish{%
  \def\chapterautorefname{Auto-NewChapterName}%
  \def\sectionautorefname{Auto-NewSectionName}%
  \def\subsectionautorefname{Auto-NewSubsectionName}%
}
\begin{document}
\chapter{Chapter Title}\label{chap}
\section{Section Title}\label{sec}
\subsection{Names}\label{subsec}
\chaptername, \sectionname, \subsectionname
\subsection{Autorefnames}
\autoref{chap}, \autoref{sec}, \autoref{subsec}
\end{document}

Result:

enter image description here

Update

If you are using an other language you have to replace »english« by the name of this language in \captionsenglish and \extraenglish, eg.

\usepackage[brazilian]{babel}
\addto\captionsbrazil{...}
\addto\extrasbrazil{...}
5
  • Yes, you got the point. But I tried this, and it did not work.
    – Marco
    Commented Aug 24, 2018 at 2:09
  • @Marco My example as above? Or my code in your document? Note, there is no MWE in your question. So nobody knows what you really doing. Additionally nobody knows what »did not work« means.
    – esdd
    Commented Aug 24, 2018 at 18:26
  • Your example. But I solved it, I posted an answer. Thanks!
    – Marco
    Commented Aug 26, 2018 at 18:15
  • My example works for english. In your question brazil is not mentioned :( So nobody knows that this language should be used. And if you replace option english by option brazil, \captionsenglish by \captionsbrazil and \extrasenglish by \extrasbrazil, it still works ...
    – esdd
    Commented Aug 26, 2018 at 19:19
  • You are right. I will just comment my previous answer here and mark your answer as accepted. "My solution: I solved it. I had to change the default names of Babel package, in this case, the brazilian captions: \addto\captionsbrazil{ \renewcommand{\chapterautorefname}{Seção} \renewcommand{\sectionautorefname}{Seção} \renewcommand{\subsectionautorefname}{Seção} } So, the Chapter, Section and Subsection Autoref names were changed to "Seção" names." Sorry for not paying more attention to your code, and for not mentioning that I used the Brazilian language.
    – Marco
    Commented Aug 26, 2018 at 19:47
0

I solved it.

I had to change the default names of Babel package, in this case, the brazilian captions:

\addto\captionsbrazil{
\renewcommand{\chapterautorefname}{Seção}
\renewcommand{\sectionautorefname}{Seção}
\renewcommand{\subsectionautorefname}{Seção}
}

So, the Chapter, Section and Subsection Autoref names were changed to "Seção" names.

1
  • 2
    In your question brazil is not mentioned :( So nobody knows that this language should be used. And if you replace option english by option brazil, \captionsenglish by \captionsbrazil and \extrasenglish by \extrasbrazil, my answer still works ...
    – esdd
    Commented Apr 22, 2021 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .