Changes

Jump to navigation Jump to search
769 bytes added ,  21:41, 10 May 2006
== Line numbering ==
In technical documents it can be required to display some code listings with the line numbers. You can do this with ConTeXt, and even more. All the features shown here are also available when displaying external files with <cmd>typefile</cmd>.
=== Preliminary setting ===
\startcode[start=200]
This is the first line
This is a rather long line that is wrapped, so look how the line numbering is done
Another line
Last line
\stopcode
</context>
 
=== Line number steps ===
You want to print a number every two lines? Ok, just use the option <tt>step=number</tt> for this.
 
<texcode>
\startcode[start=200,step=2]
This is the first line
This is a rather long line that is wrapped, so look how the line numbering is done
Another line
Last line
\stopcode
</texcode>
 
<context>
\defineframedtext
[framedcode]
[strut=yes,
offset=2mm,
width=7cm,
align=right]
 
\definetyping[code][numbering=line,
bodyfont=small,
before={\startframedcode},
after={\stopframedcode}]
 
\startcode[start=200,step=2]
This is the first line
This is a rather long line that is wrapped, so look how the line numbering is done
Anonymous user

Navigation menu