2

I have a file build from several parts. The parts are numbered and the sections are numbered as well, but without the parts number.

I would like to have the part number included in the section and subsection numbers as 1.1, 1.2 etc. as indicated in the output. Using roman numerals as I.1, .. II.1, II.2 would be ok but not desirable.

How to include the part number into the numbering of the sections in KOMA?

A MWE is

\documentclass[
      headings=standardclasses,     % to use serif font for titles 
      a4paper,10pt,notitlepage]{scrartcl}

\addtokomafont{part}{\LARGE} % reduce size of part
\addtokomafont{partnumber}{\LARGE}

\usepackage{fontspec}
\usepackage[english]{babel}

\usepackage{csquotes}  

\makeindex
\usepackage{bookmark}

\begin{document}

\section{should be 0.1}

Each page shows :

\section{should be 0.2}

The index pages list automatically.

\part{is Part 1}

\section{should be 1.1}
Some nonsense text

\subsubsection{should be 1.1.1}
The tufte style does discourage

\part{is Part 2}

\section{should be 2.1}

References 

\end{document}

and the output, where I have marked the expected numbering:

enter image description here

2
  • 1
    Just a note: headings=standardclasses does more than only change the font of the headings. To change only the font, you can use either option sfdefaults=false or command \setkomafont{sectioning}{\bfseries} (note: the official name of sectioning is disposition, but IMHO this is neither intuitive nor correct and sectioning is a valid alias and the better name). See section 3.6 of the KOMA-Script manuals for more information.
    – cabohah
    Commented May 12, 2023 at 8:00
  • You can use \RedeclareSectionCommand[counterwithin=part]{section} and \renewcommand{\thepart}{\arabic{part}}.
    – esdd
    Commented May 13, 2023 at 14:18

1 Answer 1

2
  1. make section to be reset with part
  2. redefine \thepart to use \arabic
  3. redefine \thesection to get prefixed by \thepart

Point 1 is achieved with

\counterwithin{section}{part}

which also takes care of point 3. Point 2 is achieved with

\renewcommand{\thepart}{\arabic{part}}

Note: I changed \subsubsubsection to \subsubsection.

\documentclass[
  headings=standardclasses, % to use serif font for titles 
  a4paper,
  10pt,
  notitlepage
]{scrartcl}
\usepackage{fontspec}
\usepackage[english]{babel}
\usepackage{csquotes}  
\usepackage{bookmark}

\makeindex

\addtokomafont{part}{\LARGE} % reduce size of part
\addtokomafont{partnumber}{\LARGE}

\counterwithin{section}{part}
\renewcommand{\thepart}{\arabic{part}}

\begin{document}

\section{should be 0.1}

Each page shows :

\section{should be 0.2}

The index pages list automatically.

\part{is Part 1}

\section{should be 1.1}
Some nonsense text

\subsection{should be 1.1.1}
The tufte style does discourage

\part{is Part 2}

\section{should be 2.1}

References 

\end{document}

enter image description here

1
  • It took me a while to come back to this issue and your solution works perfectly (and I even understand more or less, how it is achieved). Thanks a lot.
    – user855443
    Commented Jun 5, 2023 at 21:34

You must log in to answer this question.

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