0

I need to write reports that have numbered paragraphs. I have seen suggestions like Numbering paragraphs in latex but these require inserting \paragraph or similar each paragraph which I find tedious. With the extensive formatting options in koma-script (I use this package as my routine) I would have thought I could do something to do this automagically. I have looked in the manual but it seems that redeclaresectioncommand does not extend down to paragraphs. Does anyone have a method to produce

section 1

  1. blah blah blah
  2. blah blah

subsection 1

  1. blah blah

section 2

  1. blah blah

If the numbering resets within each section or subsection that is ok but not preferred.

thanks

3
  • With a current LaTeX you can use the new para hooks to insert such numbers. The main problem is that "paragraphs" are in many places where you don't want such a number, e.g. in the header and footer and you will have to disable them there. See e.g. tex.stackexchange.com/a/595922/2388 Nov 12, 2021 at 8:05
  • Take a look at scrjura. No promises, but I seem to recall it supports numbered paragraphs.
    – Ingmar
    Nov 12, 2021 at 8:17
  • scrjura numbers paragraphs if more than 1 in a section, but resets the numbering in each section.
    – steb
    Nov 15, 2021 at 1:04

1 Answer 1

1

Only a very clumsy solution, but maybe someone with a better knowledge can shorten this:

\documentclass[parskip=half]{scrartcl}

\usepackage{scrjura}
%\usepackage{fontspec}
\usepackage{microtype}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{remreset}


\renewcommand*{\Clauseformat}[1]{\tiny\textcolor{white}{#1}}
\addtokomafont{contract.Clause}{\tiny\color{white}}
\setkeys{contract}{preskip=-10pt, postskip=-6pt}


\begin{document}
\tableofcontents

\begin{contract}
\makeatletter{}
\@removefromreset{par}{Clause}
\@removefromreset{par}{SubClause}
\makeatother{}

  
\section{First Title}
\label{sec:first-title}
\Clause{title=dummy}


\blindtext

  \blindtext

\parnumberfalse
 \subsection{first subsec}
\label{sec:first-subsec}
\parnumbertrue
\Clause{title=dummy}
 
\blindtext

  \blindtext

  \parnumberfalse
 \section{second section}
\label{sec:secsec}
\parnumbertrue
\Clause{title=dummy}

\blindtext

  \blindtext


\end{contract}


\end{document}

So yes, the contract environment will count all paragraphs in the text for you, but only after a \Clause and unfortunately ended by any section command, so you need some extra miles to achieve what you want.

I tried a much simpler way with the new latex hooks, just:

\AddToHook{para/begin}{\stepcounter{mypara}(\themypara)}

but that numbers sections as well.

You must log in to answer this question.

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