5

I'm using \part* and \section in order to formate my file.

The problem is now, that \section just countrs from 1 to n. But what I actually need is the sections counting from 1.1 to 1.n, and then, after the second \part start over as 2.1 to 2.m.

I use \part and \section instead of \section and \subsection because of the fontsize. If there is a possibility to have \section displayed as large as \part, and \subsection as large as \section, this would also be a way to solve the problem.

Any suggestions?

lockstep
  • 250,273
Marco7757
  • 235
  • See http://tex.stackexchange.com/questions/28333/continuous-v-per-chapter-section-numbering-of-figures-tables-and-other-docume (especially the bonus question). – lockstep Nov 25 '12 at 12:57
  • Hmmm, so the higher sectional unit (\part in your example) should be unnumbered but the following unit (\section) should receive a counter fron the higher one? – Gonzalo Medina Nov 25 '12 at 13:07

1 Answers1

9

One possibility would be to redefine \thesection to include the part counter; something like:

\documentclass{article}
\usepackage{chngcntr}

\counterwithin{section}{part}

\begin{document}

\part{Test Part One}
\section{Test Section}
\section{Test Section}
\part{Test Part Two}
\section{Test Section}
\section{Test Section}

\end{document}

To get the part counter in arabic you can say

\renewcommand\thepart{\arabic{part}}

enter image description here

Another option would be to change the sectional unit formatting and use \section, \subsection instead of \part, \section, and this can be done, for example, with the titlesec package:

\documentclass{article}
\usepackage{titlesec}

\titleformat*{\section}{\huge\bfseries}
\titleformat*{\subsection}{\Large\bfseries}
\titleformat*{\subsubsection}{\normalfont\large\bfseries}

\begin{document}

\section{Test Section One}
\subsection{Test Subsection}
\subsection{Test Subsection}
\section{Test Section One}
\subsection{Test Subsection}
\subsection{Test Subsection}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • thank you very much. Your second solution is exactly what I was looking for.

    Is it possible (of course it is, but how?) to add margins at the bottom of the (sub)sections?

    – Marco7757 Nov 26 '12 at 21:38
  • @Marco7757 sure it's possible, but I quite don't understand what you want. Can you please describe in more detail what you want to achieve? – Gonzalo Medina Nov 26 '12 at 21:41
  • How would this be done for subsubsections counting from 1.1.1? – Jake Ireland Nov 16 '20 at 06:52