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.

Is it possible to have numbering such that my Chapters can contain Parts which contain Sections?

Currently I have:

Chapter
    Section{foo}
    Section{far}
    Part{baz}
        Section{bar}
    Part{Caz}
        Section{Coo}

which is being numbered:

 3.1 Foo
 3.2 Far
 I Baz
    3.3 Bar
 II Caz
    3.4 Coo

I want to have:

 3.1 Foo
 3.2 Far
 I Baz
     I.1 Bar
 II Caz
     II.1 Coo

As I'm writing this question I'm thinking perhaps it's easiest to disable chapter numbering in each Part, rather than having the Parts as subsections to Chapter:

Chapter
    Section{foo}
    Section{far}
Part{baz} % Disable chapter numbering...
    Section{bar}
Part{Caz} % Disable chapter numbering...
    Section{Coo}
% Re-enable chapter numbering...

But I'm not sure (a) if this is the best solution or (b) how to achieve this.

share|improve this question
1  
What \documentclass are you using? report or book, or perhaps something different altogether? –  Werner Dec 5 '12 at 3:20
    
...also, are you using the standard definitions for formatting within the Table of Contents? –  Werner Dec 5 '12 at 3:37
add comment

2 Answers 2

up vote 4 down vote accepted

The following is a true mock-up of your requirements, however bizarre:

enter image description here

\documentclass{report}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\makeatletter
\@addtoreset{section}{part}% Reset section counter with every \part
\newcounter{tempsection}
\newcommand{\sectionbypart}{%
  \setcounter{tempsection}{\value{section}}% Store section counter
  \setcounter{section}{0}% Reset section counter
  \renewcommand{\thesection}{\thepart.\arabic{section}}% Section counter display
}
\newcommand{\sectionbychapter}{%
  \addtocontents{toc}{\protect\addvspace{10\p@}}% Add gap in ToC when reverting to by-\chapter numbering
  \setcounter{section}{\value{tempsection}}% Restore section counter
  \renewcommand{\thesection}{\thechapter.\arabic{section}}% Section counter display
}
\makeatother
\begin{document}
\tableofcontents
\chapter{A chapter}\lipsum[1-10]
\section{foo}\lipsum[11-20]
\section{far}\lipsum[21-30]
\sectionbypart% Modify section counter to work on a by-\part basis
\part{baz}\lipsum[31-40]
\section{bar}\lipsum[41-50]
\part{Caz}\lipsum[51-60]
\section{Coo}\lipsum[61-70]
\sectionbychapter% Revert to traditional by-\chapter numbering
\section{More foo}\lipsum[71-80]
\end{document}

The macro \sectionbypart redefines the way the section counter is displayed (\thesection) to coincide with the part numbering. \sectionbychapter reverts this process by restoring the section counter value, as well as its representation.

share|improve this answer
add comment

I wouldn’t use the level macros for the enumeration, that gets messy. ( \part introduces a whole page on its own!)

I rather redefine the enumeration style.

Roman enumeration at the level of chapter

There's no need to patch \thesection (to get “I.1”, “I.2”, …) because \thechapter was used before, anyway (“3.1”, “3.2”, …).

Provided macros

  • \makeChapterRoman
    This macro saves the current value of the chapter counter in the counter chapterBackup, sets the style of \thechapter to Roman (I, II, III, …) and let the enumeration start with 1.
    The old definition of \thechapter is saved with \let to \oldThechapter (it’s easier to undo).
  • \undoChapterRoman
    This macro undoes all changes, i.e. using the old chapter value (from chapterBackup) and re-\letting \thechapter to its initial definition.

Code

\documentclass{report}
\newcounter{chapterBackup}
\newcommand*{\makeChapterRoman}{%
    \let\oldThechapter\thechapter%
    \setcounter{chapterBackup}{\value{chapter}}%
    \setcounter{chapter}{0}%
    \renewcommand*{\thechapter}{\Roman{chapter}}%
}
\newcommand*{\undoChapterRoman}{%
    \setcounter{chapter}{\value{chapterBackup}}%
    \let\thechapter\oldThechapter%
}

\begin{document}

\tableofcontents

\chapter{Chapter 1}\chapter{Chapter 2}
\chapter{Chapter 3}
\section{Foo}
\section{Far}

\makeChapterRoman

\chapter{Baz}
\section{Bar}
\chapter{Caz}
\section{Coo}

\undoChapterRoman

\chapter{Back to normal}
\section{Normal section}

\end{document}

Output

enter image description here

Roman enumeration at the level of section

At the default style a subsubsection doesn’t have a enumeration. Even with (the secnumdepth counter being greater than 2) there’s no need to redefine \thesubsubsection because it uses \thesubsection and not the raw \arabic… commands.

Provided macros

  • \makeSectionRoman
  • \undoSectionRoman

Code

\documentclass{report}
\newcounter{sectionBackup}
\newcommand*{\makeSectionRoman}{%
    \let\oldThesection\thesection%
    \let\oldThesubsection\thesubsection%
    \setcounter{sectionBackup}{\value{section}}%
    \setcounter{section}{0}%
    \renewcommand*{\thesection}{\Roman{section}}%
    \renewcommand*{\thesubsection}{\thesection.\arabic{subsection}}%
}
\newcommand*{\undoSectionRoman}{%
    \setcounter{section}{\value{sectionBackup}}%
    \let\thesection\oldThesection%
    \let\thesubsection\oldThesubsection%
}
\begin{document}
\tableofcontents
\chapter{Chapter 1}\chapter{Chapter 2}
\chapter{Chapter 3}
\section{Foo}\section{Far}

\makeSectionRoman
\section{Baz}
\subsection{Bar}
\section{Caz}
\subsection{Coo}
\undoSectionRoman

\section{Back to normal}
\subsection{Normal section}
\subsection{Another normal section}

\end{document}

Output

enter image description here

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.