* typing and linenumbering
@ 2006-03-15 22:02 nico
2006-03-16 9:02 ` Taco Hoekwater
0 siblings, 1 reply; 4+ messages in thread
From: nico @ 2006-03-15 22:02 UTC (permalink / raw)
Hello,
I would like to print some listings, with their line numbers. To achieve
this I use the following combination on framedtext, typing and
linenumbering stuff.
The output is pretty as I wish, but unfortunately the line numbers are
*not* the numbers of the listing lines, but the numbers of the lines once
wrapped in the frame. In the example below the first line is very long
(the "blah blah" line), but in the output it is shown as 4 lines (with 4
line numbers).
Is there a way to achieve this in a more integrated way with the typing
environment? The other side effect of the method used is that it changes
the linenumbering behaviour outside the typing environment. I tried the
"reset" option, but it doesn't change the intext location. Is there a
possibility to come back to default settings?
Last but not least, is it possible to customize the wrapping behaviour so
that an arbitrary command can be called before the cut, and another
command after the cut? What I would like to have is {\space\wrapsign}
before the cut and an indentation after the cut to show that the line is
wrapped.
Thanks for any hints.
% listing frame
\defineframedtext
[framelisting]
[background=screen,
frame=off,
strut=yes,
offset=2mm,
width=broad,
framecolor=black,
align=right]
\definetyping[prog]
\setuptyping[prog]
[bodyfont=small,
before={\setuplinenumbering[style=small,step=2,start=3,location=intext]
\startframelisting\startlinenumbering},
after={\stoplinenumbering\stopframelisting}]
% after={\stoplinenumbering\setuplinenumbering[reset]}]
\startprog
first line: blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah
second line
third line
last line
\stopprog
Regards,
BG
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: typing and linenumbering
2006-03-15 22:02 typing and linenumbering nico
@ 2006-03-16 9:02 ` Taco Hoekwater
2006-03-16 21:41 ` nico
0 siblings, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2006-03-16 9:02 UTC (permalink / raw)
nico wrote:
> Hello,
> The output is pretty as I wish, but unfortunately the line numbers are
> *not* the numbers of the listing lines, but the numbers of the lines once
> wrapped in the frame. In the example below the first line is very long
> (the "blah blah" line), but in the output it is shown as 4 lines (with 4
> line numbers).
I've tried this with a "method" trick, but that does not work too well
with 'location=intext'. Anyway, here is what I did:
\setuptyping[prog]
[bodyfont=small,
before={\begingroup\setuplinenumbering[style=small,%
step=2,start=3,location=inmargin,method=type]
\startframelisting \obeylines
\startlinenumbering},
after={\stoplinenumbering\stopframelisting\endgroup}]
> Is there a way to achieve this in a more integrated way with the typing
> environment?
Probably, but I do not know.
> The other side effect of the method used is that it changes
> the linenumbering behaviour outside the typing environment. I tried the
> "reset" option, but it doesn't change the intext location. Is there a
> possibility to come back to default settings?
The setup obeys normal grouping rules (hence the \begingroup ...
\endgroup in the code above)
> Last but not least, is it possible to customize the wrapping behaviour so
> that an arbitrary command can be called before the cut, and another
> command after the cut? What I would like to have is {\space\wrapsign}
> before the cut and an indentation after the cut to show that the line is
> wrapped.
That should be possible in typing environments. I even think there was
a wiki page on that. But in non-verbatim environments, the breaking is
simply TeX's paragraph builder, and I do not think context allows
tinkering with that (I could be proven wrong, of course)
Cheers, Taco
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: typing and linenumbering
2006-03-16 9:02 ` Taco Hoekwater
@ 2006-03-16 21:41 ` nico
2006-03-16 22:16 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: nico @ 2006-03-16 21:41 UTC (permalink / raw)
On Thu, 16 Mar 2006 10:02:46 +0100, Taco Hoekwater <taco@elvenkind.com>
wrote:
>> The output is pretty as I wish, but unfortunately the line numbers are
>> *not* the numbers of the listing lines, but the numbers of the lines
>> once
>> wrapped in the frame. [...]
>
> I've tried this with a "method" trick, but that does not work too well
> with 'location=intext'. Anyway, here is what I did:
>
> \setuptyping[prog]
> [bodyfont=small,
> before={\begingroup\setuplinenumbering[style=small,%
> step=2,start=3,location=inmargin,method=type]
> \startframelisting \obeylines
>
> \startlinenumbering},
> after={\stoplinenumbering\stopframelisting\endgroup}]
Ah, yes, the method=type option helps much. The behaviour is quite strange
with intext. Is it an official option?
>> The other side effect of the method used is that it changes
>> the linenumbering behaviour outside the typing environment. I tried the
>> "reset" option, but it doesn't change the intext location. Is there a
>> possibility to come back to default settings?
>
> The setup obeys normal grouping rules (hence the \begingroup ...
> \endgroup in the code above)
Yes, right. Thanks much for your help.
Regards,
BG
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: typing and linenumbering
2006-03-16 21:41 ` nico
@ 2006-03-16 22:16 ` Hans Hagen
0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2006-03-16 22:16 UTC (permalink / raw)
nico wrote:
> On Thu, 16 Mar 2006 10:02:46 +0100, Taco Hoekwater <taco@elvenkind.com>
> wrote:
>
>
>>> The output is pretty as I wish, but unfortunately the line numbers are
>>> *not* the numbers of the listing lines, but the numbers of the lines
>>> once
>>> wrapped in the frame. [...]
>>>
>> I've tried this with a "method" trick, but that does not work too well
>> with 'location=intext'. Anyway, here is what I did:
>>
>> \setuptyping[prog]
>> [bodyfont=small,
>> before={\begingroup\setuplinenumbering[style=small,%
>> step=2,start=3,location=inmargin,method=type]
>> \startframelisting \obeylines
>>
>> \startlinenumbering},
>> after={\stoplinenumbering\stopframelisting\endgroup}]
>>
>
> Ah, yes, the method=type option helps much. The behaviour is quite strange
> with intext. Is it an official option?
>
>
>>> The other side effect of the method used is that it changes
>>> the linenumbering behaviour outside the typing environment. I tried the
>>> "reset" option, but it doesn't change the intext location. Is there a
>>> possibility to come back to default settings?
>>>
>> The setup obeys normal grouping rules (hence the \begingroup ...
>> \endgroup in the code above)
>>
>
> Yes, right. Thanks much for your help.
>
actually, this verbatim specific numbering is not hooked into the typing
environments (only in the typefile stuff); so what you observe are side
effects
i'll send you a test patch off list (and to taco because we need to
trace a spurious space)
Hans
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-16 22:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-15 22:02 typing and linenumbering nico
2006-03-16 9:02 ` Taco Hoekwater
2006-03-16 21:41 ` nico
2006-03-16 22:16 ` Hans Hagen
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).