ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* line number overwriting
@ 2015-04-28 21:43 Pierre-François Bonnefoi
  2015-04-29 13:05 ` Pierre-François Bonnefoi
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre-François Bonnefoi @ 2015-04-28 21:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 787 bytes --]

Hello,

I've got some strange behavior with verbatim text :


The lines of the verbatim text got two different numbering that overwrite each other.

I think that I've read something about this but I don't find it in the mail archive.

If I remember correctly, there is a bug into the line number routine when you use a verbatim text into a column set with the paragraph command and when the verbatim text is enclosed into a frame.

Regards,
Pierre-François.

-- 
Bonnefoi Pierre-Francois                |    E-mail : bonnefoi@unilim.fr http://libpfb.so/
Universite de Limoges, Laboratoire XLIM |       Tel : 06 28 18 03 38
123 av Albert Thomas                    |  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE            |                 The Avengers.


[-- Attachment #1.2.1: Type: text/html, Size: 6500 bytes --]

[-- Attachment #1.2.2: PastedGraphic-1.png --]
[-- Type: image/png, Size: 29146 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: line number overwriting
  2015-04-28 21:43 line number overwriting Pierre-François Bonnefoi
@ 2015-04-29 13:05 ` Pierre-François Bonnefoi
  2015-04-29 14:40   ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre-François Bonnefoi @ 2015-04-29 13:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2812 bytes --]

Hello,

I've tracked down the problem :

\def\numeroLigneCode#1{\inframed[width=fit,strut=yes,frame=off,rightframe=on]{\switchtobodyfont[9pt]#1}}

\definetyping[code][numbering=line,page=yes,bodyfont=9pt,before={%
                   \begingroup%
                   \setuplinenumbering[location=text,align=left,style=\tt,command=\numeroLigneCode,distance=-.5em,width=2em]%
                   },after={\endgroup},tab=2]                                      
\starttext
\startcode
one
two
three
\stopcode

\stoptext

The result is that the option "command=\numeroLigneCode" is oddly ignored.

If I put the command "\setuplinenumbering[location=text,align=left,style=\tt,command=\numeroLigneCode,distance=-.5em,width=2em]" outside of the definition of the verbatim zone "code", it works.

This behavior seems rather strange and when it collides with using verbatim zone enclosed in "framedtext", it leads to two line numbering overwriting each other.

regards,
Pierre-François.

> On 28 Apr 2015, at 23:43, Pierre-François Bonnefoi <bonnefoi@unilim.fr> wrote:
> 
> Hello,
> 
> I've got some strange behavior with verbatim text :
> <PastedGraphic-1.png>
> 
> The lines of the verbatim text got two different numbering that overwrite each other.
> 
> I think that I've read something about this but I don't find it in the mail archive.
> 
> If I remember correctly, there is a bug into the line number routine when you use a verbatim text into a column set with the paragraph command and when the verbatim text is enclosed into a frame.
> 
> Regards,
> Pierre-François.
> 
> -- 
> Bonnefoi Pierre-Francois                |    E-mail : bonnefoi@unilim.fr <mailto:bonnefoi@unilim.fr> http://libpfb.so/ <http://libpfb.so/>
> Universite de Limoges, Laboratoire XLIM |       Tel : 06 28 18 03 38
> 123 av Albert Thomas                    |  Mrs. Peel, we're needed...
> 87060 Limoges CEDEX - FRANCE            |                 The Avengers.
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

-- 
Bonnefoi Pierre-Francois                |    E-mail : bonnefoi@unilim.fr http://libpfb.so/
Universite de Limoges, Laboratoire XLIM |       Tel : 06 28 18 03 38
123 av Albert Thomas                    |  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE            |                 The Avengers.


[-- Attachment #1.2: Type: text/html, Size: 14787 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: line number overwriting
  2015-04-29 13:05 ` Pierre-François Bonnefoi
@ 2015-04-29 14:40   ` Wolfgang Schuster
  2015-04-29 15:00     ` Pierre-François Bonnefoi
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2015-04-29 14:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 29.04.2015 um 15:05 schrieb Pierre-François Bonnefoi <bonnefoi@unilim.fr>:
> 
> Hello,
> 
> I've tracked down the problem :
> 
> \def\numeroLigneCode#1{\inframed[width=fit,strut=yes,frame=off,rightframe=on]{\switchtobodyfont[9pt]#1}}
> 
> \definetyping[code][numbering=line,page=yes,bodyfont=9pt,before={%
>                    \begingroup%
>                    \setuplinenumbering[location=text,align=left,style=\tt,command=\numeroLigneCode,distance=-.5em,width=2em]%
>                    },after={\endgroup},tab=2]                                      
> \starttext
> \startcode
> one
> two
> three
> \stopcode
> 
> \stoptext
> 
> The result is that the option "command=\numeroLigneCode" is oddly ignored.
> 
> If I put the command "\setuplinenumbering[location=text,align=left,style=\tt,command=\numeroLigneCode,distance=-.5em,width=2em]" outside of the definition of the verbatim zone "code", it works.
> 
> This behavior seems rather strange and when it collides with using verbatim zone enclosed in "framedtext", it leads to two line numbering overwriting each other.

\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]

\starttext

\startcode
one
two
three
\stopcode

\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: line number overwriting
  2015-04-29 14:40   ` Wolfgang Schuster
@ 2015-04-29 15:00     ` Pierre-François Bonnefoi
  2015-04-29 16:51       ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre-François Bonnefoi @ 2015-04-29 15:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1454 bytes --]

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...

> On 29 Apr 2015, at 16:40, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
> 
> \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]

-- 
Bonnefoi Pierre-Francois                |    E-mail : bonnefoi@unilim.fr http://libpfb.so/
Universite de Limoges, Laboratoire XLIM |       Tel : 06 28 18 03 38
123 av Albert Thomas                    |  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE            |                 The Avengers.


[-- Attachment #1.2: Type: text/html, Size: 10215 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: line number overwriting
  2015-04-29 15:00     ` Pierre-François Bonnefoi
@ 2015-04-29 16:51       ` Wolfgang Schuster
  2015-04-30  9:24         ` Pierre-François Bonnefoi
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2015-04-29 16:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 29.04.2015 um 17:00 schrieb Pierre-François Bonnefoi <bonnefoi@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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: line number overwriting
  2015-04-29 16:51       ` Wolfgang Schuster
@ 2015-04-30  9:24         ` Pierre-François Bonnefoi
  2015-05-01  9:17           ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre-François Bonnefoi @ 2015-04-30  9:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3689 bytes --]

Hello,

thank you for your solution.

As I understand this code, it's a patch to some internal processing code, so I've integrated it in my environment file.

The result is similar to the previous result :



I've two columns paragraph, with a verbatim zone in the left column that gets two numbering : 1 to 25 then 26  to 50.

If I change the numbering style with the command "\definelinenumbering" associated to the verbatim zone from the global numbering style, I get one numbering with the  
particular style and the other with the global style.

I don't know if this gives insight into the process that occurs in the rendering engine.

Thank you very much for your help,
Pierre-François.

> On 29 Apr 2015, at 18:51, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
> 
>> 
>> Am 29.04.2015 um 17:00 schrieb Pierre-François Bonnefoi <bonnefoi@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
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

-- 
Bonnefoi Pierre-Francois                |    E-mail : bonnefoi@unilim.fr http://libpfb.so/
Universite de Limoges, Laboratoire XLIM |       Tel : 06 28 18 03 38
123 av Albert Thomas                    |  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE            |                 The Avengers.


[-- Attachment #1.2.1: Type: text/html, Size: 54321 bytes --]

[-- Attachment #1.2.2: PastedGraphic-2.png --]
[-- Type: image/png, Size: 94299 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: line number overwriting
  2015-04-30  9:24         ` Pierre-François Bonnefoi
@ 2015-05-01  9:17           ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2015-05-01  9:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 30.04.2015 um 11:24 schrieb Pierre-François Bonnefoi <bonnefoi@unilim.fr>:
> 
> Hello,
> 
> thank you for your solution.
> 
> As I understand this code, it's a patch to some internal processing code, so I've integrated it in my environment file.
> 
> The result is similar to the previous result :
> <PastedGraphic-2.png>
> 
> 
> I've two columns paragraph, with a verbatim zone in the left column that gets two numbering : 1 to 25 then 26  to 50.
> 
> If I change the numbering style with the command "\definelinenumbering" associated to the verbatim zone from the global numbering style, I get one numbering with the  
> particular style and the other with the global style.

When you create custom typing environment context also creates a line numbering environment with the same name
and to change its values you should use the \setuplinenumbering command and not \definelinenumbering.

> I don't know if this gives insight into the process that occurs in the rendering engine.

Please make a minimal example with the problem.

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-01  9:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 21:43 line number overwriting Pierre-François Bonnefoi
2015-04-29 13:05 ` Pierre-François Bonnefoi
2015-04-29 14:40   ` Wolfgang Schuster
2015-04-29 15:00     ` Pierre-François Bonnefoi
2015-04-29 16:51       ` Wolfgang Schuster
2015-04-30  9:24         ` Pierre-François Bonnefoi
2015-05-01  9:17           ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).