I am trying to create a LaTeX document that will automatically number paragraphs without the need to use \paragraph - the reason for this is that I am processing text that will be written by others who do not use LaTeX.
Edit: this is why the solution at paragraph numbering does not address my particular problem as it requires that \paragraph is replaced by \item. This gives me the same problem as far as I can tell.
I have searched for several solutions which have helped me make progress and also warned that the use of \everypar can be problematic... The current situation is that I almost have a solution but a new \section or \subsection causes the subsequent paragraph to drop the numbering as shown in the attached image. Further paragraphs are numbered correctly.
Alternative numbering solutions would be acceptable to me - I have no real preference for whether the paragraph numbers flow consecutively through all sections or follow a within-section pattern.
My minimal working example is as follows (note I have a need to use the \titlesec package to make the document look pretty). I am really scratching my head about this one - any help or pointers will be gratefully received!
\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage{titlesec}
\setcounter{secnumdepth}{3}
\newcounter{para}
\newcommand*{\numberedparagraph}{%
\refstepcounter{para}
\textbf{\thepara.\space}
}
\let\oldep\everypar\newtoks\everypar
\oldep{\the\everypar\everypar{\numberedparagraph}}
\begin{document}
\everypar{\numberedparagraph}
\section{Section 1}
\lipsum[1-2]
\section{Section 2}
\lipsum[4-5]
\subsection{A Subsection}
\lipsum[6-7]
\end{document}


\paragraphwith a need to use\itemso it gives me the same problem really...? – quabbage Dec 21 '17 at 12:55\everyparbut addresses\sectionetc. – Nicola Talbot Dec 21 '17 at 13:09\everyparwithout interruption by sectioning commands). – Nicola Talbot Dec 21 '17 at 13:12\@afterheading. This sounds a bit scary but I will try to figure it out :) – quabbage Dec 21 '17 at 13:21