Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Basically, I would like a way to number the lines in a block of text, without resorting to verbatim mode.

I have tried

\definetyping[code][numbering=line,style=\tf]
\startcode[step=5]
  Thus, I came to the conclusion that
  the designer of a new system must not
  only be the implementer and first
  large-scale user; the designer should
  also write the first user manual.
\stopcode

but this preserves the whitespace; I would like ConTeXt to lay out the paragraph normally and then number the lines. The numbering does not need to be in the margin, but I would like to be able to skip every n numbers and use columns. The solution with definetyping is quite close; I simply would like to avoid having to manually adjust line breaks and possibly have hyphenation.

I found Show the number of lines in margin for LaTeX, but that doesn't apply here, unless there is a ConTeXt equivalent (the wiki does not mention one and Google turns up nothing).

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Use \startlinenumbering, it re-wraps the text and does not preserve the line endings. The step key and hyphenation work as well.

\starttext
  \startlinenumbering [step=5]
    \input knuth
  \stoplinenumbering
\stoptext

result

For further information see the ConTeXT wiki - \startlinenumbering.

share|improve this answer
    
Thanks! I can't believe I didn't see that searching the wiki... –  li.davidm Jan 28 '13 at 23:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.