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?

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

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.