## LaTeX forum ⇒ General ⇒ \renewcommand{\chaptername}{} does NOT work -- why?

LaTeX specific issues not fitting into one of the other forums of this category.
nvx
Posts: 25
Joined: Mon Dec 17, 2007 7:49 pm

### \renewcommand{\chaptername}{} does NOT work -- why?

Hello everyone,
I am trying to get rid of (or rename) the "Chapter x" string before names of chapters. As far as I know, the command
\renewcommand{\chaptername}{}

in the preamble should do the trick. Nevertheless, I can't get it to work. I have tried putting it into a new document with one chapter and the least possible number of loaded packages to avoid possible package "interference", but the result was the same -- the word "Chapter" is still there...

I wouldn't mind renaming the "Chapter" to "Part", since I'm writing a report and "Part" would be quite appropriate, but even if I use
\renewcommand{\chaptername}{Part}

it still does not do what I want it to do.

I use MiKTeX and, I have never had problems with this system since this one. What am I doing wrong?

Thanks a lot for any help...

Best regards,
nvx

P.S.: Document class "article" is not an option, I unfortunately need more than just sections...

LaTeXguide.org • LaTeX-Cookbook.net

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

### \renewcommand{\chaptername}{} does NOT work -- why?

The problem can be the use of the babel package. Please consider the following examples:

1) This will change the \chaptername from chapter to part.
\documentclass{report}
\renewcommand\chaptername{Part}

\begin{document}
\chapter{First chapter}
\end{document}

2) This won't change the \chaptername from chapter to part.
\documentclass{report}
\usepackage[english]{babel}
\renewcommand\chaptername{Part}

\begin{document}
\chapter{First chapter}
\end{document}

3) When using the babel package you have to use the \addto commad, as the following code shows:
\documentclass{report}
\usepackage[english]{babel}
\renewcommand\chaptername{Part}}

\begin{document}
\chapter{First chapter}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

### \renewcommand{\chaptername}{} does NOT work -- why?

First of all you should provide some code. The reason why your redefinition fails could come from the babel package. But to answer that clearly, I need to know your (complete) preamble.

An alternative could be using the classes of the KOMA Script Bundle. In these classes, the option nochapterprefix is set as default and results in the effect you want to have. For further information refer to the documentation.

Best regards and welcome on Board
Thorsten
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

nvx
Posts: 25
Joined: Mon Dec 17, 2007 7:49 pm

### Re: \renewcommand{\chaptername}{} does NOT work -- why?

Thank you both for providing the hints. It was really due to the use of the "babel" package.

Best regards,
nvx

kalmer
Posts: 1
Joined: Sat Apr 02, 2022 9:58 pm

### \renewcommand{\chaptername}{} does NOT work -- why?

I get the following error:

! Undefined control sequence.
<recently read> \addto 

The first example works well once the PDF-file is generated directly from TEX-file. However if that TEX-file is just part of a bookdown project then it doesn't do anything.

Stefan Kottwitz
Posts: 9861
Joined: Mon Mar 10, 2008 9:44 pm

### \renewcommand{\chaptername}{} does NOT work -- why?

Hi Kalmer,

welcome to the forum!

It seems that you did not load the babel package.

Stefan