# “Chapter” appearing at the start of every chapter

I'm using a template from a website, and every time a new chapter starts, 'Chapter 3' for example appears and its quite absurd. How do I edit this feature out of the code?

-
Have you tried using \chapter*{Chapter title}? –  Werner May 12 '14 at 23:38
@Werner First thing I tried, but this also excludes it from the table of contents which I did not want –  user3448561 May 12 '14 at 23:40
Are you saying that the chapter number does not change? –  Sigur May 12 '14 at 23:47
@Sigur At the start of every chapter in the main body, theres a big line of text saying "Chapter 4" for example. –  user3448561 May 12 '14 at 23:52
The typical solution here is to use \chapter*{Chapter title}\addtocontents{toc}{chapter}{Chapter title}, but this can be automated. Can you please provide us with a minimal working example (MWE) that shows your current setup... it's just easier to see whether this might conflict with a solution rather than giving you something that might not work right away. –  Werner May 12 '14 at 23:52

You are using dmathesis which is based on the standard report document class and keeps the standard definitions for formatting chapter headings, so you can use the titlesec package:

\documentclass{dmathesis}
\usepackage{titlesec}

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

\begin{document}

\tableofcontents
\chapter{Test chapter one}
\chapter[Two]{Test chapter two}

\end{document}


If you don't want to load titlesec, you can redefine \@makechaptertitle:

\documentclass{dmathesis}

\makeatletter
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
%    \ifnum \c@secnumdepth >\m@ne
%        \huge\bfseries \@chapapp\space \thechapter
%    \par\nobreak
%        \vskip 20\p@
%    \fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother

\begin{document}

\tableofcontents
\chapter{Test chapter one}
\chapter[Two]{Test chapter two}

\end{document}


and the first page of the first chapter is:

As you can see, the full functionality of \chapter is preserved (you have the optional argument for an eventual different entry in the ToC and headers and also marks are appropriately generated).

Another option would be to patch the command with the help of, for example, etoolbox.

-

The following addition using xparse forces chapters to be seen as a starred chapter:

\documentclass{dmathesis}
\usepackage{xparse}

\let\oldchapter\chapter
\RenewDocumentCommand{\chapter}{s o m}{%
\oldchapter*{#3}%
\IfNoValueTF{#2}

\begin{document}

\tableofcontents

\chapter[A test chapter]{Test chapter}

\end{document}


One advantage is that it still allows for a different ToC entry for each chapter using \chapter[<ToC entry>]{<Body entry>}.

-
Doesn't this destroy the marking mechanism for (eventual) headers? –  Gonzalo Medina May 13 '14 at 2:38
@GonzaloMedina: Yes; those definition can be added to the updated \chapter command. For example, adding \chaptermark{<*>} in either of the conditional location will restore the usual chapter marks. –  Werner May 13 '14 at 3:31