[Tex/LaTex] How to reset paragraph numbering only after new chapter

numberingsectioningtitlesec

I'm writing a report that needs some annoying formatting. The \chapters and \paragraphs need to be numbered using arabic numbers.

The paragraph numbering needs to be reset at the commencement of each new chapter. The \section, \subsection, and \subsubsection headings should not be numbered, nor should they have any effect on the \paragraph numbering.

I can't figure out how to:

  1. Reset the \paragraph numbering to 1 at the start of each \chapter.
  2. Prevent the \paragraph numbering from being reset at the start of a new \subsubsection.

Bearing in mind I have used the titlesec package to change the appearance of my titles, what is the easiest way to achieve the desired outcome?

\documentclass[a4paper,11pt,twoside]{report}
%  Paragraph counter
\setcounter{secnumdepth}{5}
\renewcommand\theparagraph{\arabic{paragraph}}
\usepackage{graphicx,amssymb,amstext,amsmath,calc}
% Section headings
\usepackage[noindentafter,calcwidth]{titlesec}
\titleformat{\chapter}
    [hang]
    {\normalfont\uppercase}
    {\bf{\thechapter.}}
    {1em}
    {\bfseries\filcenter}
    []
\titleformat{\section}
    [hang]
    {\normalfont\uppercase}
    {}
    {0pt}
    {\bfseries}
    []
\titleformat{\subsection}
    [hang]
    {\normalfont}
    {}
    {0pt}
    {\bfseries}
    []
\titleformat{\subsubsection}
    [hang]
    {\normalfont}
    {}
    {0pt}
    {}
    [{\titleline*[l]{\titlerule}}]
\titleformat{\paragraph}
    [runin]
    {\normalfont}
    {\theparagraph.} 
    {1em}
    {}
    []
\titlespacing*{\paragraph}
    {0pc}
    {11pt}
    {11pt}
    []
\begin{document}
\chapter{First Chapter}
\paragraph{}First paragraph, numbered 1.
\section{First Section}
\paragraph{}Second paragraph, numbered 2.
\subsection{First Subsection}
\paragraph{}Third paragraph, numbered 3.
\subsubsection{First Subsubsection}
\paragraph{}Fourth paragraph, should be numbered 4.
\chapter{Second chapter, numbered 2.}
\paragraph{}This paragraph should be numbered 1.
\end{document}

Best Answer

The chngcntr package is perfect for doing this sort of thing:

\usepackage{chngcntr}
\counterwithout{paragraph}{subsubsection} % removes paragraph from the subsubsections
\counterwithin{paragraph}{chapter} % makes paragraph depend on chapter
\renewcommand{\theparagraph}{\arabic{paragraph}} % redefine the display of the paragraph