groff
[Top][All Lists]
Advanced

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

RE: [Groff] macros for inserting code


From: Ted Harding
Subject: RE: [Groff] macros for inserting code
Date: Sun, 26 Aug 2001 09:26:58 +0100 (BST)

On 24-Aug-01 Paul Martinolich wrote:
> Presently, I just use \fC and .br commands to add code to my
> documentation.  Is there any groff equivalents to <code></code>?
> 
> Paul

Not "pre-packed" -- but you can easily roll your own. For example:

  .de code
  .fam C
  .ad 0
  .nf
  .in +0.5i
  ..
  .de /code
  .fam T
  .ad b
  .fi
  .in
  ..

and you can vary the details to suit your taste (for instance,
I find that code looks better when printed if the point-size is
dropped a fraction and the font is Courier Bold).

Note, by the way, that in many macro packages giving  "new
paragraph" request (e.g. ".LP" in ms macros) will reset the
environment so as to undo what is set by ".code"; however,
if you use your defintions as ".code  [lines of code] ./code
within a paragraph, there should be no complications; you can
elaborate the above to ensure that they work in a context-independent
way, e.g.

  .de code
  .nr old_FAM \\n[FAM]
  .fam C
  .ad 0
  .nf
  .in +0.5i
  ..
  .de /code
  .fam \\n[old_FAM]
  .ad b
  .fi
  .in
  ..

I'm not recommending any "ultimate" solution to this: as I say,
a lot depends on what effect you want to produce, and on the
context (e.g. which macro packs) in which you use it.

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 26-Aug-01                                       Time: 09:26:58
------------------------------ XFMail ------------------------------

reply via email to

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