Difference between revisions of "Paragraph Enumeration"

From Wiki
Jump to navigation Jump to search
m
(POint reader to Paragraf Referencing/pararef module)
Line 1: Line 1:
 
== Standard Paragraph Numbering ==
 
== Standard Paragraph Numbering ==
  
ConTeXt has a built-in mechanism for paragraph numbering, which places numbers in the margin.  This is accessed with <cmd>setupparagraphnumbering</cmd>, as in this example, which also sets the number style to italic rather than the default roman.
+
ConTeXt has a built-in mechanism for paragraph numbering, which places numbers in the margin.  This is accessed with {{cmd|setupparagraphnumbering}}.
 +
 
 +
The mechanism numbers ‘TeX paragraphs’, so a formula or an itemization item will get its own number. For ‘block of thought’ paragraphs that can contain multiple TeX paragraphs, see the {{module|pararef}} module described at [[Paragraph Referencing]].
  
 
<context source="yes">
 
<context source="yes">
\setuplayout[scale=0.8,width=13cm]
+
\setuppapersize[A5]
 
\starttext
 
\starttext
 
Some text in an unnumbered paragraph before the paragraph numbering starts.
 
Some text in an unnumbered paragraph before the paragraph numbering starts.
Line 14: Line 16:
 
more than one line, so as to show that these are paragraph numbers and not
 
more than one line, so as to show that these are paragraph numbers and not
 
line numbers.
 
line numbers.
 +
 +
\startitemize[packed]
 +
    \item an
 +
    \item itemization
 +
\stopitemize
  
 
A third numbered paragraph.
 
A third numbered paragraph.
Line 25: Line 32:
 
== Paragraph Numbering in the Text ==
 
== Paragraph Numbering in the Text ==
  
An alternate way of numbering paragraphs is to place the numbers in the running text, rather than in the margin.  ConTeXt doesn't have a built-in way to do this, but it's not difficult to add a method using the <cmd>everypar</cmd> macro.  The following code was proposed by Taco on the mailing list.
+
An alternate way of numbering paragraphs is to place the numbers in the running text, rather than in the margin.  ConTeXt doesn't have a built-in way to do this, but it's not difficult to add a method using the {{cmd|everypar}} macro.  The following code was proposed by Taco on the mailing list.
  
 
<context source="yes" text="This produces the following result:">
 
<context source="yes" text="This produces the following result:">
\setuplayout[scale=0.8,width=13cm]
+
\setuppapersize[A6]
 
\newcounter\Paracount
 
\newcounter\Paracount
 
\setcounter\Paracount1
 
\setcounter\Paracount1

Revision as of 10:35, 13 October 2012

Standard Paragraph Numbering

ConTeXt has a built-in mechanism for paragraph numbering, which places numbers in the margin. This is accessed with \setupparagraphnumbering.

The mechanism numbers ‘TeX paragraphs’, so a formula or an itemization item will get its own number. For ‘block of thought’ paragraphs that can contain multiple TeX paragraphs, see the t-pararef module described at Paragraph Referencing.

\setuppapersize[A5]
\starttext
Some text in an unnumbered paragraph before the paragraph numbering starts.

\setupparagraphnumbering[state=start,style=italic,distance=0pt]
This is the first numbered paragraph; it's short.

This is another numbered paragraph.  It's long enough to wrap around onto
more than one line, so as to show that these are paragraph numbers and not
line numbers.

\startitemize[packed]
    \item an
    \item itemization
\stopitemize

A third numbered paragraph.
\setupparagraphnumbering[state=stop]

And, finally, an unnumbered paragraph after the paragraph numbering.
\stoptext


Paragraph Numbering in the Text

An alternate way of numbering paragraphs is to place the numbers in the running text, rather than in the margin. ConTeXt doesn't have a built-in way to do this, but it's not difficult to add a method using the \everypar macro. The following code was proposed by Taco on the mailing list.

\setuppapersize[A6]
\newcounter\Paracount
\setcounter\Paracount1
\def\Paragraphnumber%
   {\increment\Paracount 
    \Paracount.~}
\def\startParagraphNumbers%
   {\par \begingroup \appendtoks \Paragraphnumber \to \everypar}
\def\stopParagraphNumbers%
   {\par \endgroup}

\starttext
Some text in an unnumbered paragraph before the paragraph numbering starts.

\startParagraphNumbers
This is the first numbered paragraph; it's short.

This is another numbered paragraph.  It's long enough to wrap around onto
more than one line, so as to show that these are paragraph numbers and not
line numbers.

A third numbered paragraph.
\stopParagraphNumbers

And, finally, an unnumbered paragraph after the paragraph numbering.
\stoptext

This produces the following result: