Code: Select all
\documentclass{article}
\usepackage{lipsum}
\usepackage{etoolbox}
\author{Some One}
\title{Numbered Paragraphs Example}
\newcounter{para}
\newcommand*{\numberedparagraph}{%
\refstepcounter{para}\thepara.\space
}
\makeatletter
\preto\section{\everypar{}}
\preto\subsection{\everypar{}}
\preto\subsubsection{\everypar{}}
\renewcommand{\@afterheading}{%
\@nobreaktrue
\everypar{%
\if@nobreak
\@nobreakfalse
\clubpenalty\@M
\if@afterindent
\else
{\setbox\z@\lastbox}%
\fi
\else
\clubpenalty\@clubpenalty
\everypar{\numberedparagraph}%
\fi
\numberedparagraph
}%
}
\makeatother
\begin{document}
\maketitle
\section{Sample Section}
\lipsum[1-4]
Some\label{sample} sample text.
\lipsum[5-10]
\subsection{Sample Subsection}
\lipsum[11-15]
\section{Another Section}
\lipsum[16-30]
Cross-reference to paragraph~\ref{sample} on page~\pageref{sample}.
\end{document}
1. Head Section
1.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1.1 Hed Subsection
1. XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2. XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(end subsection)
3. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX