[OS X TeX] damn... how to surpress chapter titles?
Bruno Voisin
Bruno.Voisin at hmg.inpg.fr
Mon Jul 1 16:31:47 CEST 2002
Le lundi 1 juillet 2002, à 03:10 , mahakk a écrit :
> i'm using the class "report", and when i use
>
> \chapter{How it all started}
> \chapter{How it ended}
>
> i get
>
> Chapter 1
> How it all started
>
> Chapter 2
> How it ended
>
> but i want it to be
>
> 1 How it all started
> 2 How it ended
>
> plus, i want only the chapters' titles to appear in the table of
> contents,
> not the "chapter"-prefix.
It's not really Mac OS X-specific stuff. I don't know about the FAQs,
but generally when you want to fine-tune the output of LaTeX you need to:
- first look at the LaTeX Companion (fairly outdated); and, if your
question isn't answered there,
- look at how the output of LaTeX is created in the various files
defining the LaTeX format.
These files are in /usr/local/teTeX/share/texmf/tex/latex/base/. For the
"report" document class, the chapter head is created by the control
sequences \@makechapterhead (for \chapter{stuff}) and \@makeschapterhead
(for \chapter*{stuff}), defined in report.cls. To suppress "Chapter "
you have to copy the definition of these sequences, paste them in the
preamble of you document, enclose them between \makeatletter and
\makeatother, and rewrite the lines:
\ifnum \c at secnumdepth >\m at ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
(inferring that \@chapapp creates the word "Chapter", \thechapter the
chapter number, \par the line break and #1 the chapter title).
Similarly for changing the table-of-contents entry you need to
redefine \@chapter and \@schapter (which define what information goes
into the table of contents) and \l at chapter (which defines how each entry
of the table is formatted).
For example last week I was writing a report using the "report" class,
and here's the chapter-related stuff that went into the preamble
(assuming the package "ifthen" was loaded before):
\makeatletter
\renewcommand{\@makechapterhead}[1]
{{\setlength{\parindent}{0pt}\raggedright
\normalfont\interlinepenalty=10000\LARGE\bfseries
\ifthenelse{\value{secnumdepth}>-1}{\thechapter. }{}%
#1\par\nobreak
\vspace{17pt}}}
\renewcommand{\@makeschapterhead}[1]
{{\setlength{\parindent}{0pt}\raggedright
\normalfont\interlinepenalty=10000\LARGE\bfseries
#1\par\nobreak
\vspace{17pt}}}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand*{\l at chapter}[2]
{\ifthenelse{\value{tocdepth}>-1}
{\addpenalty{-\@highpenalty}
\vspace{1.0em plus 1pt}
\setlength{\@tempdima}{1.8em}
\begingroup
\setlength{\parindent}{0pt}
\setlength{\rightskip}{\@pnumwidth}
\setlength{\parfillskip}{-\@pnumwidth}
\addtolength{\leftskip}{\@tempdima}
\leavevmode\bfseries\hspace{-\leftskip}%
#1\nobreak\hfil\nobreak\makebox[\@pnumwidth][r]{#2}\par
\penalty\@highpenalty
\endgroup}
{}}
\makeatother
Good luck!
Bruno Voisin
-----------------------------------------------------------------
Threaded list archives can be found at:
<http://www.masda.vxu.se/~pku/MacOSX_TeX/>
-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
-----------------------------------------------------------------
More information about the macostex-archives
mailing list