9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] line numbers in troff
@ 2011-05-19 13:09 hugo rivera
  2011-05-19 13:44 ` Steve Simon
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: hugo rivera @ 2011-05-19 13:09 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,
usually, when writting drafts for somebody else to review, its useful
to have line numbers printed at the beginning of each line.
How would you implement that in troff? I never written a macro in
troff, so some basic pointers would be enough for me (e.g. some good
troff book).
Thanks,

--
Hugo



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

* Re: [9fans] line numbers in troff
  2011-05-19 13:09 [9fans] line numbers in troff hugo rivera
@ 2011-05-19 13:44 ` Steve Simon
  2011-05-19 14:38   ` Bruce Ellis
  2011-05-19 17:15 ` Lyndon Nerenberg (VE6BBM/VE7TFX)
  2011-05-19 20:48 ` Charles Forsyth
  2 siblings, 1 reply; 8+ messages in thread
From: Steve Simon @ 2011-05-19 13:44 UTC (permalink / raw)
  To: 9fans

macros are easy enough: start them with .de XX and end them with .., e.g.
start and end code example which I end up adding to most documents I write:

.de EX
.nj
.nf
.CW
.SM
..

.de EE
.fi
.ju
.LG
.R
..

There are quite a few books, see http://www.troff.org/ , my favorite is
"Document formatting & typsetting on the UNIX system".

I really don't know how you would add line numbers, if you are lucky there
may be a well-known macro which is run at the start of every line...

-Steve



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

* Re: [9fans] line numbers in troff
  2011-05-19 13:44 ` Steve Simon
@ 2011-05-19 14:38   ` Bruce Ellis
  2011-05-19 14:43     ` Sape Mullender
  0 siblings, 1 reply; 8+ messages in thread
From: Bruce Ellis @ 2011-05-19 14:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Funny you should mention this. I know there is a way (done for patent
applications). I think I can find it in the troff doc. I have to by
tomorrow so I'll report back.

brucee

On Thu, May 19, 2011 at 11:44 PM, Steve Simon <steve@quintile.net> wrote:
> macros are easy enough: start them with .de XX and end them with .., e.g.
> start and end code example which I end up adding to most documents I write:
>
> .de EX
> .nj
> .nf
> .CW
> .SM
> ..
>
> .de EE
> .fi
> .ju
> .LG
> .R
> ..
>
> There are quite a few books, see http://www.troff.org/ , my favorite is
> "Document formatting & typsetting on the UNIX system".
>
> I really don't know how you would add line numbers, if you are lucky there
> may be a well-known macro which is run at the start of every line...
>
> -Steve
>
>



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

* Re: [9fans] line numbers in troff
  2011-05-19 14:38   ` Bruce Ellis
@ 2011-05-19 14:43     ` Sape Mullender
  2011-05-19 14:51       ` Bruce Ellis
  0 siblings, 1 reply; 8+ messages in thread
From: Sape Mullender @ 2011-05-19 14:43 UTC (permalink / raw)
  To: 9fans

I think at the top of the page you set a trap to go off at the next line.
In the trap macro you reset the trap for the line after that.  And so on,
down the page.

	Sape

> Funny you should mention this. I know there is a way (done for patent
> applications). I think I can find it in the troff doc. I have to by
> tomorrow so I'll report back.
>
> brucee
>
> On Thu, May 19, 2011 at 11:44 PM, Steve Simon <steve@quintile.net> wrote:
>> macros are easy enough: start them with .de XX and end them with .., e.g.
>> start and end code example which I end up adding to most documents I write:
>>
>> .de EX
>> .nj
>> .nf
>> .CW
>> .SM
>> ..
>>
>> .de EE
>> .fi
>> .ju
>> .LG
>> .R
>> ..
>>
>> There are quite a few books, see http://www.troff.org/ , my favorite is
>> "Document formatting & typsetting on the UNIX system".
>>
>> I really don't know how you would add line numbers, if you are lucky there
>> may be a well-known macro which is run at the start of every line...
>>
>> -Steve
>>
>>




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

* Re: [9fans] line numbers in troff
  2011-05-19 14:43     ` Sape Mullender
@ 2011-05-19 14:51       ` Bruce Ellis
  0 siblings, 0 replies; 8+ messages in thread
From: Bruce Ellis @ 2011-05-19 14:51 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

.nm is your friend.

brucee

On Fri, May 20, 2011 at 12:43 AM, Sape Mullender
<sape@plan9.bell-labs.com> wrote:
> I think at the top of the page you set a trap to go off at the next line.
> In the trap macro you reset the trap for the line after that.  And so on,
> down the page.
>
>        Sape
>
>> Funny you should mention this. I know there is a way (done for patent
>> applications). I think I can find it in the troff doc. I have to by
>> tomorrow so I'll report back.
>>
>> brucee
>>
>> On Thu, May 19, 2011 at 11:44 PM, Steve Simon <steve@quintile.net> wrote:
>>> macros are easy enough: start them with .de XX and end them with .., e.g.
>>> start and end code example which I end up adding to most documents I write:
>>>
>>> .de EX
>>> .nj
>>> .nf
>>> .CW
>>> .SM
>>> ..
>>>
>>> .de EE
>>> .fi
>>> .ju
>>> .LG
>>> .R
>>> ..
>>>
>>> There are quite a few books, see http://www.troff.org/ , my favorite is
>>> "Document formatting & typsetting on the UNIX system".
>>>
>>> I really don't know how you would add line numbers, if you are lucky there
>>> may be a well-known macro which is run at the start of every line...
>>>
>>> -Steve
>>>
>>>
>
>
>



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

* Re: [9fans] line numbers in troff
  2011-05-19 13:09 [9fans] line numbers in troff hugo rivera
  2011-05-19 13:44 ` Steve Simon
@ 2011-05-19 17:15 ` Lyndon Nerenberg (VE6BBM/VE7TFX)
  2011-05-19 20:48 ` Charles Forsyth
  2 siblings, 0 replies; 8+ messages in thread
From: Lyndon Nerenberg (VE6BBM/VE7TFX) @ 2011-05-19 17:15 UTC (permalink / raw)
  To: 9fans

> usually, when writting drafts for somebody else to review, its useful
> to have line numbers printed at the beginning of each line.
> How would you implement that in troff?

See /sys/doc/troff.ps (section 15 on page 26).

--lyndon




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

* Re: [9fans] line numbers in troff
  2011-05-19 13:09 [9fans] line numbers in troff hugo rivera
  2011-05-19 13:44 ` Steve Simon
  2011-05-19 17:15 ` Lyndon Nerenberg (VE6BBM/VE7TFX)
@ 2011-05-19 20:48 ` Charles Forsyth
  2011-06-08  2:13   ` hugo rivera
  2 siblings, 1 reply; 8+ messages in thread
From: Charles Forsyth @ 2011-05-19 20:48 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

.nm 1 turns on line number mode
.nm 0 turns it off
.nn N turns it off for the next N lines
.nm 1 M   numbers every M lines following

there are other options

[-- Attachment #2: Type: message/rfc822, Size: 2771 bytes --]

From: hugo rivera <uair00@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] line numbers in troff
Date: Thu, 19 May 2011 15:09:23 +0200
Message-ID: <BANLkTim492owEYVniWE=W6XzF3o2sDTSGg@mail.gmail.com>

Hello,
usually, when writting drafts for somebody else to review, its useful
to have line numbers printed at the beginning of each line.
How would you implement that in troff? I never written a macro in
troff, so some basic pointers would be enough for me (e.g. some good
troff book).
Thanks,

--
Hugo

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

* Re: [9fans] line numbers in troff
  2011-05-19 20:48 ` Charles Forsyth
@ 2011-06-08  2:13   ` hugo rivera
  0 siblings, 0 replies; 8+ messages in thread
From: hugo rivera @ 2011-06-08  2:13 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Thanks a lot.

2011/5/19 Charles Forsyth <forsyth@terzarima.net>:
> .nm 1 turns on line number mode
> .nm 0 turns it off
> .nn N turns it off for the next N lines
> .nm 1 M   numbers every M lines following
>
> there are other options
>
> ---------- Mensaje reenviado ----------
> From: hugo rivera <uair00@gmail.com>
> To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
> Date: Thu, 19 May 2011 15:09:23 +0200
> Subject: [9fans] line numbers in troff
> Hello,
> usually, when writting drafts for somebody else to review, its useful
> to have line numbers printed at the beginning of each line.
> How would you implement that in troff? I never written a macro in
> troff, so some basic pointers would be enough for me (e.g. some good
> troff book).
> Thanks,
>
> --
> Hugo
>



-- 
Hugo



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

end of thread, other threads:[~2011-06-08  2:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 13:09 [9fans] line numbers in troff hugo rivera
2011-05-19 13:44 ` Steve Simon
2011-05-19 14:38   ` Bruce Ellis
2011-05-19 14:43     ` Sape Mullender
2011-05-19 14:51       ` Bruce Ellis
2011-05-19 17:15 ` Lyndon Nerenberg (VE6BBM/VE7TFX)
2011-05-19 20:48 ` Charles Forsyth
2011-06-08  2:13   ` hugo rivera

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