[Help] [LaTeX top]

Latex Sections

How to adjust sections in latex. Note that modifications may need to be made if article, book, or 12pt is used instead of report 10pt.

How to change which sections are numbered

Each sectiontype (chapter, section, ...) has a number associated with it. Two other counters determine when section numbers are printed (secnumdepth) and what sections appear in the table of contents (tocdepth).

secnumdepth (Taken from rep10.doc.)

%    LEVEL      : a number, denoting depth of section -- e.g., chapter=1,
%                 section = 2, etc.  A section number will be printed if
%                 and only if LEVEL < or = the value of the secnumdepth
%                 counter.
If you set before \begin{document},
\setcounter{secnumdepth}{3}
then chapters, sections, and subsections will have numbers but not subsubsections or below

The following deals with the relationship between LEVEL and table of contents entry. (Taken from report.doc.)

%    LEVEL    : An entry is produced only if LEVEL < or = value of 
%               'tocdepth' counter.  Note, \chapter is level 0, \section
%               is level 1, etc.
Setting
\setcounter{tocdepth}{1}
means that only chapters and sections will appear

Remember that this should be done in your document before the \begin{document} command not in rep10.doc.

How to change the appearance of the numbers when they do appear (roman instead of arabic or 2.1.1 instead of 1.1)

From report.doc
% For any counter CTR, \theCTR is a macro that defines the printed
% version of counter CTR.  It is defined in terms of the following
% macros:
%
%  \arabic{COUNTER} : The value of COUNTER printed as an arabic numeral.
%  \roman{COUNTER}  : Its value printed as a lower-case roman numberal.
%  \Roman{COUNTER}  : Its value printed as an upper-case roman numberal.
%  \alph{COUNTER}   : Value of COUNTER printed as a lower-case letter:
%                         1 = a, 2 = b, etc.
%  \Alph{COUNTER}   : Value of COUNTER printed as an upper-case letter:
%                           1 = A, 2 = B, etc.
%
\def\thechapter       {\arabic{chapter}}
\def\thesection       {\thechapter.\arabic{section}}
So to change the chapter number to be roman do
\def\thechapter{\Roman{chapter}}
and chapters will appear as I, II, III. Note that this will automatically change sections to I.1, I.2,....

To change things so only one number appears in section headings do

\def\thesection{\arabic{section}}

how to change the appearance of the entire section (large bf instead of normalsize italic)

To adjust how the sections look, you should examine the definitions from rep10.doc.
% \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE} 
%            optional * [ALTHEADING]{HEADING}
%    Generic command to start a section.  
%    NAME       : e.g., 'subsection'
%    LEVEL      : a number, denoting depth of section -- e.g., chapter=1,
%                 section = 2, etc.  A section number will be printed if
%                 and only if LEVEL < or = the value of the secnumdepth
%                 counter.
%    INDENT     : Indentation of heading from left margin
%    BEFORESKIP : Absolute value = skip to leave above the heading.  
%                 If negative, then paragraph indent of text following 
%                 heading is suppressed.
%    AFTERSKIP  : if positive, then skip to leave below heading,
%                       else - skip to leave to right of run-in heading.
%    STYLE      : commands to set style
%  If '*' missing, then increments the counter.  If it is present, then
%  there should be no [ALTHEADING] argument.  A sectioning command
%  is normally defined to \@startsection + its first six arguments.

\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
    -.2ex}{2.3ex plus .2ex}{\Large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
   -.2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\paragraph{\@startsection
     {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
     {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus 
     .2ex}{-1em}{\normalsize\bf}}
I'll examine the subsubsection command in detail
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
NAME
subsubsection
LEVEL
3
INDENT
0pt (\z@ is shorthand for 0pt). This is the indentation from the left margin
BEFORESKIP
3.25ex plus 1ex minus .2ex skip before the section; also the paragraph immediately after is not indented.
AFTERSKIP
1.5ex plus .2ex vertical skip between the end of the title and the start of the line. If the value had been negative then the skip would be horizontal.
STYLE
normalsize and boldface
To change a definition, just copy the appropriate bit (say paragraph) to your style files and adjust the parameters. \def\paragraph{\@startsection {paragraph}{4}{\z@}{2.25ex plus 1ex minus .2ex}{1ex plus .2ex}{\normalsize\bf}}
[CSLI] [Help] [Stanford] [Search CSLI help pages] [Search CSLI pages] [Search Stanford]
Emma Pease
Last modified: Wed Mar 15 13:50:08 PST 2006 by emma@csli.stanford.edu