34

How do I remove "Chapter N" from the chapters when using the book document class?

This does not appear in the TOC (which I don't want, either).

But it appears at the beginning of a chapter, and on each page, in the header.

Emanuel Berg
  • 1,827
  • How are you producing your headers? – Gonzalo Medina Jun 24 '13 at 04:17
  • @GonzaloMedina: They appear automatically on each page that isn't a "new chapter" page - I guess because of the book mode. – Emanuel Berg Jun 24 '13 at 04:19
  • What about the table of contents? Should the chapter entries remain numbered? What about sections, should they still carry the chapter number as a prefix? – Gonzalo Medina Jun 24 '13 at 04:21
  • @GonzaloMedina: Yes, to both questions. – Emanuel Berg Jun 24 '13 at 04:23
  • Please see my updated answer. – Gonzalo Medina Jun 24 '13 at 04:32
  • Could you clarify what you mean by the "page headers"? – einpoklum Jun 24 '13 at 07:10
  • 2
    If you want unnumbered chapters in the book class, and if you're not tweeking the appearance of your chapter titles, you should use the \chapter* command, not the \chapter command. –  Jun 24 '13 at 07:22
  • @MarcvanDongen the problem with \chapter* is that Emanuel still wants numbered chapter entries in the ToC and chapter numbers as prefixes for lower sectional units (see the first comments). – Gonzalo Medina Jun 24 '13 at 14:07
  • @einpoklum: Check out the edit for a dump showing the header. – Emanuel Berg Jun 24 '13 at 19:18
  • @GonzaloMedina: Where did you answer go? It was correct, and now it works. Check out the edit to the question. – Emanuel Berg Jun 24 '13 at 19:19
  • @EmanuelBerg I deleted it, since I wasn't sure it had helped. I've now un-deleted it. – Gonzalo Medina Jun 24 '13 at 19:21
  • Emanuel, please place your final solution as a separate answer or just drop it, now that @GonzaloMedina's answer is undeleted. – einpoklum Jun 25 '13 at 08:32
  • @einpoklum: What do you mean? I accepted his answer, because it was the source of the code snippet that did the work, however, for any future reader of this question it is beneficial just getting the quick "fix", because not everyone has the time/interest to really understand why and how something is a solution. – Emanuel Berg Jun 25 '13 at 11:21
  • @einpoklum: Done, perhaps a bit silly but sure, details are important. – Emanuel Berg Jun 27 '13 at 22:11
  • I don't understand this. What's the point of providing good answers with several valid options? – Gonzalo Medina Jun 27 '13 at 22:25
  • @GonzaloMedina: I think you should have the credit with my comments in the question, as it were, but einpoklum seemed very certain so I did as he told me, as I don't think this is anything to waste time on. – Emanuel Berg Jun 27 '13 at 22:28
  • So my answer is a waste of time? I certainly think it is now that I read your comment. – Gonzalo Medina Jun 27 '13 at 22:31
  • @GonzaloMedina: No, a waste of time to make a new answer out of my comments (that I previously had put in the question), and accept that answer, as einpoklum told me. – Emanuel Berg Jun 27 '13 at 22:32
  • I don't know, but it seems a little redundant. What's the point then? Every user can then write his/her own answer and accept it. I don't know if this is the way things are supposed to be. – Gonzalo Medina Jun 27 '13 at 22:43
  • @GonzaloMedina: I agree, I thought it was correct the way it was, but please, let us not waste our short lives on this, OK? – Emanuel Berg Jun 27 '13 at 22:44
  • @EmanuelBerg sure :-) – Gonzalo Medina Jun 27 '13 at 22:45

5 Answers5

30

With the help of titlesec:

\documentclass{book}
\usepackage{titlesec}
\usepackage{lipsum}

\titleformat{\chapter}[display]
  {\normalfont\bfseries}{}{0pt}{\Large}

\begin{document}

\chapter{Test Chapter}
\lipsum[3]

\end{document}

Without titlesec:

\documentclass{book}
\usepackage{lipsum}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \interlinepenalty\@M
    \Large \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Large \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother
\begin{document}

\chapter{Test Chapter}
\lipsum[3]

\end{document}

enter image description here

To customize the headers/footers, one option is to use the fancyhdr package; a little example, suppressing the prefix "Chapter N" from the default headers, and with the text in normal case (no upper-case):

\documentclass{book}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{lipsum}

\titleformat{\chapter}[display]
  {\normalfont\bfseries}{}{0pt}{\Large}

\pagestyle{fancy}

\fancyhf{}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
\fancyhead[LE,RO]{\thepage}
\renewcommand\headrulewidth{0pt}
\renewcommand\chaptermark[1]{\markboth{#1}{}} 
\renewcommand\sectionmark[1]{\markright{\thesection.\ #1}}

\begin{document}

\chapter{Test Chapter}
\section{Test Section}
\lipsum[1-20]

\end{document}

Another option for the headers/footers is to use the pagestyles option for titlesec and design the desired style:

\documentclass{book}
\usepackage[pagestyles]{titlesec}
\usepackage{fancyhdr}
\usepackage{lipsum}

\titleformat{\chapter}[display]
  {\normalfont\bfseries}{}{0pt}{\Large}
\newpagestyle{mystyle}{
  \sethead[\thepage][][\chaptertitle]{\thesection~\sectiontitle}{}{\thepage}
}
\pagestyle{mystyle}

\begin{document}

\chapter{Test Chapter}
\section{Test Section}
\lipsum[1-20]

\end{document}
einpoklum
  • 12,311
Gonzalo Medina
  • 505,128
16

Partial solution

Thanks to einpoklum's answer, I found that this

\titleformat{\chapter}[display]
{\bfseries\Large}                                            
{\filright}
{1ex}{}[]

solves the problem for the chapter start.

But the page headers remain.

Full solution

It appears this did it. Thanks to Gonzalo Medina, for his answer, from where I exerted the code.

\usepackage[pagestyles]{titlesec}
\titleformat{\chapter}[display]{\normalfont\bfseries}{}{0pt}{\Huge}
\newpagestyle{mystyle}
{\sethead[\thepage][][\chaptertitle]{}{}{\thepage}}
\pagestyle{mystyle}

Now it looks the way I like. (The screenshots got dusty, for some reason.)

chapter http://user.it.uu.se/~embe8573/chapter.png header http://user.it.uu.se/~embe8573/header.png

Emanuel Berg
  • 1,827
3

The 'Chapter N' text is the value of the \@chapapp macro, defined in the book document class.

But... no need to tinker with that directly. See

How to create specific chapter style in book documentclass

it refers you to the titlesec package and to these pages, with which you can change the chapter heading style. One of the things you can do, specifically, is play with the way the number is displayed.

einpoklum
  • 12,311
3

I found adding an asterisk after chapter works, like this: \chapter*{Introduction}

Found on https://www-users.york.ac.uk/~pjh503/LaTeX/text.html

It worked for me.

C. Daza
  • 31
  • 1
0

To remove the "Chapter n", just need to add \setcounter{secnumdepth}{-1} before the \begin{document}

Source:

The ctan package documentation says

@chapter | This macro is called when we have a numbered chapter. When secnumdepth is larger than −1 and, in the book class, @mainmatter is true, we display the chapter number. We also inform the user that a new chapter is about to be typeset by writing a message to the terminal.

%% example code in the documentation
790 \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
791 ⟨book⟩ \if@mainmatter
792 \refstepcounter{chapter}%
793 \typeout{\@chapapp\space\thechapter.}%
794 \addcontentsline{toc}{chapter}%
795 {\protect\numberline{\thechapter}#1}%
796 ⟨∗book⟩
797 \else
798 \addcontentsline{toc}{chapter}{#1}%
799 \fi
800 ⟨/book⟩
801 \else
802 \addcontentsline{toc}{chapter}{#1}%
803 \fi

For example, if you need to remove "Part N" for \part, then you change it for \setcounter{secnumdepth}{-2} and so on.