Difference between revisions of "Paragraph Enumeration"

From Wiki
Jump to navigation Jump to search
 
(add ConTeXt native way)
Line 1: Line 1:
 +
This code was proposed by Taco to the list:
 
<texcode>
 
<texcode>
  
Line 26: Line 27:
  
 
Unnambered text after.
 
Unnambered text after.
 +
\stoptext
 +
</texcode>
 +
If you're happy with numbers in the margin, this is in-built ConTeXt way, with <cmd>setupparagraphnumbering</cmd>:
 +
<texcode>
 +
\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
 
\stoptext
 
</texcode>
 
</texcode>

Revision as of 08:19, 29 April 2005

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