groff
[Top][All Lists]
Advanced

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

Re: [Groff] Macro arguments question


From: Tadziu Hoffmann
Subject: Re: [Groff] Macro arguments question
Date: Mon, 14 Nov 2005 17:35:08 +0100
User-agent: Mutt/1.5.6i

Just wanted to clarify a few things about environments.  The
idea of environments is to define several different "parameter
sets" for formatting, with the purpose of being able to easily
switch between them (e.g., one environment for the normal body
text, one for footnotes, etc.), and to be able to make changes
in one without disturbing the others.  Inheritance like in the
unix environment would defeat that purpose.  Here is a simple
annotated example that illustrates the use of environments.
Play around with it a bit and see if you can make sense of it.


.\" ----------------------------------------------------------------
.\" -- define the environments --
.\" - environment 0, normal text -
.ps 12
.vs 14
.ll 8.5c
.lt 8.5c
.ev 1 \" - environment for footnotes -
.ps 10
.vs 12
.ll 8c
.lt 8c
.ev \" - back to previous environment -
.\"
.\" -- footnote (to keep things simple, actually an "inline-note") --
.de FN
.\" no .br here, we don't want to interrupt the running text
.ev 1 \" switch to footnote environment, using smaller point size
.di FND \" format stuff into footnote diversion
\\$1
.br \" make sure we get all of the footnote text
.di \" done with footnote
.ev \" and back to previous environment
.wh \\n(.du+1u FNP \" set trap to print footnote on following line
..
.\" -- print footnote --
.de FNP
.tl ''\v'-.3m'\D'l \\n(.lu 0'' \" titles don't disturb running text
.ev 1 \" switch away from environment 0 to not disturb running text
.nf \" replay footnote diversion in no-fill mode to preserve formatting
.FND
.fi
.ev \" back to previous environment
.tl ''\v'-.3m'\D'l \\n(.lu 0'' \" another rule to finish footnote
.ch FNP \" remove trap
..
.\" -- use --
.sp 3c
Running text running text running text running text running*
.FN "*This is a \(lqfootnote.\(rq  \
(Should print in smaller size, with shorter line length.)  \
Can run over several lines in output."
text running text running text running text running text
running text running text running text running text.
.\" ----------------------------------------------------------------






reply via email to

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