Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using report document class. I want to remove word "Chapter" and chapter number from chapter title, so when new chapter starts I will get only chapter title. I can do it using:

\renewcommand{\chaptername}{}
\renewcommand{\thechapter}{}

It looks ok, but it breaks the table of contents. I want numbered chapters on toc, e.g.

  1. Function name one

1.1 Parameters

1.2 Returned value

but the table of contents looks like this:

Function name one

.1 Parameters

.2 Returned value

I know I can do it using the package titlesec, but is there a way to do it without it?

share|improve this question
add comment

2 Answers 2

up vote 13 down vote accepted

You can redefine the internal way of the chapter output:

\makeatletter
\def\@makechapterhead#1{%
  \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
share|improve this answer
    
thank you! works perfectly! –  jmatraszek Oct 5 '11 at 9:35
add comment

Basically you will want to renew the command that deals with the chapter title formatting. This link explains it pretty well. Since you don't want the starred version, you can settle with changing the normal version.

\renewcommand{\@makechapterhead}[1]{%
 \vspace*{50\p@}%
 {\parindent \z@ \raggedright \normalfont
  \hrule                                        % horizontal line
  \vspace{5pt}%                                 % add vertical space
  \ifnum \c@secnumdepth >\m@ne
   \huge\scshape \@chapapp\space \thechapter    % Chapter number
   \par\nobreak
   \vskip 20\p@
  \fi
  \interlinepenalty\@M
  \Huge \scshape #1\par                         % chapter title
  \vspace{5pt}%                                 % add vertical space
  \hrule                                        % horizontal rule
  \nobreak
  \vskip 40\p@
 }%
}

What you will want to do is comment out the line that has the Chapter number comment and the surrounding comments (everything inside of the if) to get rid of the extra space. You can customize this command a little further if you want to change the looks of the chapter headings. Take note that you have to wrap this in \makeatletter and \makeatother to change the catcode for the @ symbol. So you would get:

\makeatletter
\renewcommand{\@makechapterhead}[1]{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
  \hrule                                        % horizontal line
  \vspace{5pt}%                                 % add vertical space
  \interlinepenalty\@M
  \Huge \scshape #1\par                         % chapter title
  \vspace{5pt}%                                 % add vertical space
  \hrule                                        % horizontal rule
  \nobreak
  \vskip 40\p@
  }%
}
\makeatother

And a simple test document

\documentclass{report}
\begin{document}
\makeatletter
\renewcommand{\@makechapterhead}[1]{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
  \hrule                                        % horizontal line
  \vspace{5pt}%                                 % add vertical space
  \interlinepenalty\@M
  \Huge \scshape #1\par                         % chapter title
  \vspace{5pt}%                                 % add vertical space
  \hrule                                        % horizontal rule
  \nobreak
  \vskip 40\p@
  }%
}
\makeatother
\tableofcontents
\chapter{Test}
 some test text
\end{document}

Would look like this:

toc chapter caption

edit: too slow :(

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.