Changes

Jump to navigation Jump to search
m
remove dead mailing list link
== 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}}.
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]]. <texcodecontext source="yes">\setuppapersize[A5]
\starttext
Some text in an unnumbered paragraph before the paragraph numbering starts.
This is the first numbered paragraph; it's short.
This is another numbered paragraph. it's rather a bit longer. Specifically,itIt's long enough to wrap around onto more than one line, so as to show thatthese are paragraph numbers and not line numbers.
A third numbered paragraph.\setupparagraphnumberingstartitemize[state=stoppackedAnd, finally, \item an unnumbered paragraph after the paragraph numbering. \stoptext</texcode> <context>\starttextSome text in an unnumbered paragraph before the paragraph numbering starts.item itemization\setupparagraphnumbering[state=start,style=italic,distance=0pt]This is the first numbered paragraph; it's short. This is another numbered paragraph. it's rather a bit longer. Specifically,it's long enough to wrap around onto more than one line, so as to show thatthese are paragraph numbers and not line numbers.stopitemize
A third numbered paragraph.
== 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.
<texcodecontext source="yes" text="This produces the following result:">\setuppapersize[A6]
\newcounter\Paracount
\setcounter\Paracount1
This is the first numbered paragraph; it's short.
This is another numbered paragraph. it's rather a bit longer. Specifically,itIt's long enough to wrap around onto more than one line, so as to show thatthese are paragraph numbers and not line numbers.
A third numbered paragraph.
And, finally, an unnumbered paragraph after the paragraph numbering.
\stoptext
</texcodecontext== Combining Section Numbering with Paragraph Numbering and Titles ==
This produces Idris provided a modified version of an enumerated-paragraphs sample provided by Wolfgang. In the following result/modified version, section numbering is combined with paragraph enumeration, with titles optional:
<contextsource="yes" text="The output from the previous code is:">\newcounterdefineseparatorset [ParagraphNumber][.,] % no second decimal for susubparagraphs% \Paracountdefineseparatorset [ParagraphNumber][.,.] % second decimal for susubparagraphs \setcounterdefinecounter[ParagraphNumber][numberseparatorset=ParagraphNumber,criterium=all] \Paracount1define\ParagraphNumber {{\defbf \Paragraphnumberincrementcounter[ParagraphNumber]% \convertedcounter[ParagraphNumber][numbersegments=1]}\quad} \define\subParagraphNumber {{\incrementbf \Paracount incrementcounter[ParagraphNumber][2]% \convertedcounter[ParagraphNumber][numbersegments=1:2]}\Paracount.~quad} \defdefine\startParagraphNumbers%subsubParagraphNumber {{\par bf \begingroup incrementcounter[ParagraphNumber][3]% \appendtoks convertedcounter[ParagraphNumber][numbersegments=1:3]}\Paragraphnumber quad} \to setuphead[section] [style=\everypar}bf, alternative=text, criterium=all, number=no, textcommand=\defParagraphNumber, insidesection=\stopParagraphNumbershskip-0.49em] %adjust space after title \setuphead[subsection] {[style=\bf, alternative=text, criterium=all, number=no, textcommand=\par subParagraphNumber, insidesection=\endgroup}hskip-0.49em] % adjust space after title
\setuphead[subsubsection]
[style=\bf,
alternative=text,
criterium=all,
number=no,
textcommand=\subsubParagraphNumber,
insidesection=\hskip-0.49em] % adjust space after title
\setupwhitespace[line]
\starttext
Some text in an unnumbered paragraph before the paragraph numbering starts\startsection[title={Text.}]\input ward\startsubsection\input ward\startsubsubsection[title={Text.}]\input ward\stopsubsubsection\stopsubsection\stopsection
\startParagraphNumbersstartsectionThis is the first numbered paragraph; it's short.\input ward\startsubsubsectionThis is another numbered paragraph. it's rather a bit longer. Specifically,\input wardit's long enough to wrap around onto more than one line, so as to show thatthese are paragraph numbers and not line numbers. A third numbered paragraph.\stopsubsubsection\stopParagraphNumbers And, finally, an unnumbered paragraph after the paragraph numbering.stopsection
\stoptext
</context>
 
[[Category:Basics]]

Navigation menu