# [NTG-context] line number overwriting

Wolfgang Schuster schuster.wolfgang at gmail.com
Wed Apr 29 18:51:51 CEST 2015

> Am 29.04.2015 um 17:00 schrieb Pierre-François Bonnefoi <bonnefoi at unilim.fr>:
>
> Thank you very much for your solution.
>
> When using it into a paragraph, the line number disappears :
>
> \defineframed[numeroLigneCode][location=low,width=fit,strut=yes,frame=off,rightframe=on]
>
> \definetyping[code][numbering=line,page=yes,bodyfont=9pt,tab=2]
>
> \setuplinenumbering[code][location=text,align=left,style={\switchtobodyfont[9pt,tt]},command=\numeroLigneCode,distance=-.5em,width=2em]
>
> \defineparagraphs[TwoCols][n=2,before=,after=]
>
> \starttext
> \startTwoCols
> \startcode
> one
> two
> three
> \stopcode
> \TwoCols
> hum
> \stopTwoCols
> \stoptext
>
> I've tried to use the command "\definelinenumbering" without success.
>
> I don't know what happened…

To add line numbers to text in a box some kind of post processing is necessary and the paragraphs
environment doesn’t perform this yet but it can be added with a single line in the code. I don’t if there
are side effect from this change and if this is the right place for the line but it works in the following example.

\unprotect

\def\typo_paragraphs_stop_cell_yes
{\ifvmode
\removelastskip
\else
\removeunwantedspaces
\endstrut
\endgraf
\fi
\paragraphsparameter\c!bottom
\egroup % (2)
% The following is necessary to show line numbers in a paragraphs environment
\page_postprocessors_linenumbers_box\scratchbox
\dontleavehmode\hbox{\raise\strutheight\box\scratchbox}%
\endgroup}

\protect

\defineparagraphs[Test][n=2]

\setuptyping[numbering=line,tab=no]

\starttext

\startparagraphs[Test]

\startparagraphscell

\input ward

\starttyping
One
Two
Three
\stoptyping

\stopparagraphscell

\startparagraphscell
Second column
\stopparagraphscell

\stopparagraphs

\stoptext

Wolfgang