groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Newbie help for documenting code snippets


From: Jon Snader
Subject: Re: [Groff] Newbie help for documenting code snippets
Date: Wed, 12 Jan 2005 09:08:08 -0500
User-agent: Mutt/1.4.2.1i

On Wed, Jan 12, 2005 at 06:23:10AM -0000, mahesh wrote:
> Hi all,
> 
> I would like to generate documentation for some C code, along the lines of 
> Richard Steven's books.
> 
> He usually has a numbered block of code demarcated by two lines.
> Following this is a para with the relevent line numbers set off in the left 
> margin.
> 
> I have not been able to create this "effect".
> 

What effect specifically are you concerned about?  Basically the
whole thing works with a begin code block macro that draws the
top line and sets some parameters, and a end code block macro
that draws the bottom line.  The code explanations are (usually)
begun with a .CP macro that takes the two line numbers as
arguments.  The line number(s) are first set in a string
variable.  The CP macro measures the length of the string and
outdents by the length before printing the line numbers.  Notice
that the whole effects depends on having the main body of text
indented from the headers.

jcs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]