2

Steven B. Segletes has devised a well working way to count paragraphs that doesn't seem to interfere with all the (many) packages that I am using in my book. Apart for one exception: The crop-package will count its marks and header-info as paragraphs.

\documentclass[a5paper]{article}

\usepackage{lipsum}

\usepackage[cam,a4,center]{crop}

\newcounter{parcount}
\let\oldep\everypar%
\newenvironment{enumpars}
{\newtoks\everypar%
\setcounter{parcount}{0}%
\oldep{\the\everypar\stepcounter{parcount}%
    \textbf{(\theparcount)}\qquad}%
\par}{\global\let\everypar\oldep\par}

\begin{document}

\begin{enumpars}
\lipsum[1-5]
\end{enumpars}

\lipsum[6-8]

\begin{enumpars}
\lipsum[9-14]
\end{enumpars}

\end{document}

Would there be a way to "shield" \everypar perhaps by saving its content before crop starts its working?

2

With a current LaTeX you can try this. But in a real document there can be more paragraphs appearing in wrong places

\documentclass[a5paper]{article}

\usepackage{lipsum,etoolbox}
\newbool{parabool}

\usepackage[cam,a4,center]{crop}

\newcounter{parcount}

\AddToHook{para/begin}[enumpars]{\ifbool{parabool}{\stepcounter{parcount}\textbf{(\theparcount)}\qquad}{}}

\newenvironment{enumpars}
 {\setcounter{parcount}{0}%
  \booltrue{parabool}\par}
{}

\makeatletter
\preto\CROP@@@marks{\boolfalse{parabool}}
\makeatother
\begin{document}

\begin{enumpars}
\lipsum[1-5]
\end{enumpars}

\lipsum[6-8]

\begin{enumpars}
\lipsum[9-14]
\end{enumpars}

\end{document}

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.