[Tex/LaTex] Chapter.Part.Section numbering

numberingsectioning

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.

Best Answer

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.