Changes

Jump to navigation Jump to search
1,232 bytes removed ,  17:58, 4 March 2010
m
no edit summary
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.
<texcode>\starttextSome text in an unnumbered paragraph before the paragraph numbering starts. \setupparagraphnumbering[statecontext source=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 ontomore than one line, so as to show that these are paragraph numbers and notline numbers. A third numbered paragraph.\setupparagraphnumbering[state=stop] And, finally, an unnumbered paragraph after the paragraph numbering.\stoptext</texcode> <context"yes">
\setuplayout[scale=0.8,width=13cm]
\starttext
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.
<texcode>\newcounter\Paracount\setcounter\Paracount1\def\Paragraphnumber% {\increment\Paracount \Paracount.~}\def\startParagraphNumbers% {\par \begingroup \appendtoks \Paragraphnumber \to \everypar}\def\stopParagraphNumbers% {\par \endgroup} \starttextSome context source="yes" text in an unnumbered paragraph before the paragraph numbering starts. \startParagraphNumbersThis is the first numbered paragraph; it's short. This is another numbered paragraph. It's long enough to wrap around ontomore than one line, so as to show that these are paragraph numbers and notline numbers. A third numbered paragraph.\stopParagraphNumbers And, finally, an unnumbered paragraph after the paragraph numbering.\stoptext</texcode> ="This produces the following result/ <context:">
\setuplayout[scale=0.8,width=13cm]
\newcounter\Paracount
68

edits

Navigation menu