Paragraph Enumeration

From Wiki
Revision as of 08:19, 29 April 2005 by Adam (talk | contribs) (add ConTeXt native way)
Jump to navigation Jump to search

This code was proposed by Taco to the list:


\newcounter\Paracount
\setcounter\Paracount1

\def\Paragraphnumber%
   {\increment\Paracount 
    \Paracount.~}

\def\startParagraphs%
   {\par \begingroup \appendtoks \Paragraphnumber \to \everypar}

\def\stopParagraphs%
   {\par \endgroup}

\starttext

Unnumbered text before.

\startParagraphs
This is the first numbered paragraph.

This is another paragraph. This is another
paragraph. This is another paragraph.
\stopParagraphs

Unnambered text after.
\stoptext

If you're happy with numbers in the margin, this is in-built ConTeXt way, with \setupparagraphnumbering:

\starttext
\showframe
\setupcolors[state=start]
\setupparagraphnumbering[state=start,style=italic,distance=0pt]
\section{bloo}
\input knuth 
\section{blah}
\input knuth \par 
\setupparagraphnumbering[state=stop]
\input tufte \par
\setupparagraphnumbering[state=start,color=red]
\dorecurse{4}{\input tufte \par}
\stoptext