[texhax] Alternative chapter level sectioning

Bart Wise tug at wiseguysweb.com
Thu Nov 15 07:00:41 CET 2007


On Thu November 15 2007 4:22:05 am Andy Farnell wrote:
> Apologies for the noise in case of this being a FAQ, but I haven't found a
> source that directly answers this question.
>
>
> My book alternates between two styles, theory and practice. Each element of
> theory is given a chapter.
>
> I would like to define a new entity, called a "Practical", existing at the
> same level as "Chapter", and in all important respects identical to a
> chapter but for:
>
> 1) It's section name, appearing in the TOC and section title is
> "Practical". 2) Practicals are numbered separately from chapters.
>
> leading to a structure like
>
> Chapter 1: Theory of operators
> Chapter 2: Fourier theory
> Practical 1: Additive synthesis
> Chapter 3: Chebyshev and Bessel
> Practical 2: Waveshaping synthesis
>
>
> My OO instinct is that I can somehow derive a new Practical class
> from Chapter.
>
> How might I go about this?
>
> Thankyou.
>
> Andy Farnell

Use the titlesec package to create the additional level. 
Try the following and modify as needed.


\documentclass[10pt,twoside]{book}
\usepackage[noindentafter]{titlesec}
\usepackage{titletoc}

\titleclass{\practical}{top}[\part]
\newcounter{practical}
\renewcommand{\thepractical}{\arabic{practical}}

\titlecontents{chapter}
              [1.5em]
              {}
              {\contentslabel{2.3em}}
              {\hspace*{-2.3em}}
              {\titlerule*[1pc]{.}\contentspage}

\titlecontents{practical}
              [1.5em]
              {}
              {\contentslabel{2.3em}}
              {\hspace*{-2.3em}}
              {\titlerule*[1pc]{.}\contentspage}

\begin{document}
\tableofcontents
\titleformat{\practical}[display]
	{\bfseries\sffamily\slshape\LARGE}	% format
	{\titlerule[1pt]			% label
         \vspace{1pt}%
         \titlerule
         \vspace{1pc}%
         \LARGE\MakeUppercase{Practical} \thepractical}
	{0pt}					% separator
	{}					% before
	[]					% after
\titlespacing{\practical}{0ex}{-5ex}{8ex}

\chapter{Chapter One Title}

\chapter{Chapter Two Title}

\practical{Practical One Title}

\chapter{Chapter Three Title}

\practical{Practical Two Title}

\end{document}


More information about the texhax mailing list