2

I use this document class: \documentclass[a4paper,12pt]{article}. Can someone please help me to form such style of table of contents.

I need:

  • the arabic numbering everywhere in the toc (now "parts" are roman)
  • resetting of section number counter in each part (now they just keep getting incremented)
  • to make part number with a dot to preceed the section number (now only sections numbers are displayed)
  • indentation of sections relative to parts, identation of subsections relative to sections (now sections are directly under the parts)

It should look like this:

1 Part Name
   1.1 Section Name
   1.2 Section Name

2 Part Name
   2.1 Section Name
   2.2 Section Name
   2.3 Section Name
       2.3.1 Subsection Name

2 Answers 2

0

There are a couple of problems here:

  • You have the wrong hierarchy for sectioning commands. Sections are inside chapters, not parts. Parts are intended to contain a number of chapters, not a number of sections. Use \chapter instead of \part and a lot of your problems with disappear.
  • You shouldn't be using \part with the base LaTeX article class. If you want to stick with the base LaTeX document classes, use report rather than article if the document truly does contain parts. You can use the report class for a document that does not contain parts (highest entity is a \chapter).
1
  • 1
    \part can be used in article. Probably azerIO doesn't want the "dramatic" appearance of chapters in the report class.
    – egreg
    Jun 21, 2011 at 10:32
2
\documentclass[a4paper]{article}
\usepackage{chngcntr}
\usepackage[titles]{tocloft}
\renewcommand{\thepart}{\arabic{part}}
\counterwithin{section}{part}

\setlength{\cftsecindent}{2em}
\setlength{\cftsecnumwidth}{2em}
\setlength{\cftsubsecindent}{4em}
\setlength{\cftsubsecnumwidth}{2.5em}

\begin{document}
\tableofcontents
\part{Uno}
\section{Uno}
\part{Due}
\section{Due}
\subsection{Due}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .