# No clue where to put \thechapter

In my ToC I need a chapter word next to chapters.

Where to put \thechapter to get result

\renewcommand*\@seccntformat[1]{ \csname the#1\endcsname.\enspace}
\def\numberline#1{\hb@xt@\@tempdima{#1.\hfil}}
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.0em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\mdseries
\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
%
\def\@makechapterhead#1{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\normalsize \bfseries \MakeUppercase{\@chapapp}\space \thechapter
\par\nobreak
\vskip\baselineskip
\fi
\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@
}}
%

-
What are you trying to achieve? You are making your own document class? While such code snippets might seem good, this definitely needs a full Minimal Working Example that would show us the complete context. – yo' Oct 20 '12 at 14:08
It is document class made by my teacher. I do not know where to put \thechapter to get word Chapter in ToC. It is not posible to give Minimal Working Example. It is a class file (.cls) – Daniel Miliński Oct 20 '12 at 14:19
I don't understand why you don't mention that you want to have the word "Chapter" in your question. Read your question and try to understand it, having no more information than what is written there. You probably need to add \chaptername{}  (notice the space at the end) before #1 in the definition of \l@chapter. But I'm afraid that the result will not be satisfactory. However, we cannot test it, so I don't think we can help you more. – yo' Oct 20 '12 at 15:03
Somewhat similar to @tohecz' suggestion, use \@chapapp~#1\nobreak\mdseries in your definition of \l@chapter. – Werner Oct 20 '12 at 15:12
Can you upload elsewhere (pastebin, for example) the .cls file so we can look at the definition for \l@chapter? – Gonzalo Medina Oct 20 '12 at 15:19

## 1 Answer

As has been mentioned in the comments, you can add \@chapapp right before #1 in the definition of \l@chapter; in the following example I used the book document class, but this will work with the other class used:

\documentclass{book}

\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.0em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
\@chapapp~#1\nobreak\mdseries% NEW
\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother

\begin{document}

\tableofcontents
\chapter{Test Chapter One}
\chapter{Test Chapter Two}

\end{document}


-