groff
[Top][All Lists]
Advanced

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

Re: [Groff] Attaching a string to the beginning of each line?


From: Tadziu Hoffmann
Subject: Re: [Groff] Attaching a string to the beginning of each line?
Date: Fri, 15 Nov 2002 11:34:10 +0100
User-agent: Mutt/1.4i

The email-quoting problem sounded rather fun, so I played
around with it somewhat and implemented a solution which
trapped every output line and inserted the appropriate
email-quotes.  However, Werner's idea of using margin
characters for this purpose is brilliant.  It makes the
coding so much simpler!  Here's my "quoted indent" macro
using margin characters.  The "french quotation" macro is
essentially the same, except that the action is delayed
and invoked with a trap.

Now, I've never seen such a french quotation in real life,
but it does raise some interesting questions, such as:
can these constructs be nested, and if yes, what is the
recommended style?


(By the way, why does \h[...] work but not \w[...]?)




.\" ----------------------------------------------------------------
.de QI
.br
.ie \\n[.$] \{\
.nr QI0 \\n[QI]
.nr QI +1
.ds QI\\n[QI] \\*[QI\\n[QI0]]\\$1\0
.\}
.el \{\
.nr QI -1
.\}
.in \w'\\*[QI\\n[QI]]'u
.ie \\n[QI] \{\
.char \[QI] \h[-\\n[.l]u]\\*[QI\\n[QI]]
.mc \[QI] 0
.blm QIX
.\}
.el \{\
.mc
.blm
.\}
..
.de QIX
.br
\&
.br
..
.ds QI0
.\" ----------------------------------------------------------------
.de FQ
.ie \\n[.$] \{\
.ds FQC \\$1
\\*[FQC]\ \c
'in \w'\\*[QI\\n[QI]]\\*[FQC]\ 'u
.\}
.el \{\
.ds FQC
.nr QI0 \\n[QI]-1
'in \w'\\*[QI\\n[QI0]]'u
.\}
.wh \\n[.d]u+1v FQX
..
.de FQX
.ch FQX
.ie '\\*[FQC]'' \{\
.nr QI -1
.\}
.el \{\
.nr QI0 \\n[QI]
.nr QI +1
.ds QI\\n[QI] \\*[QI\\n[QI0]]\\*[FQC]\ \"
.\}
.ie \\n[QI] \{\
.char \[QI] \h[-\\n[.l]u]\\*[QI\\n[QI]]
.mc \[QI] 0
.\}
.el \{\
.mc
.\}
..
.\" ----------------------------------------------------------------

.ll 5c
.sp 3

On Monday, 11 November 2002 at 15:15:07 +0000,
Ralph Corderoy wrote:
.QI >

Hi,

.QI :::
Basically what I'm looking for is something like a
filled indent: normally an indent just has spaces
on the left, but I want > characters.
.QI
.QI >

This is not possible currently (well, maybe it is,
but a macro solution would be rather fragile I believe).
>From troff's TODO list:

.QI \0\(br\|
A line prefix request to make e.g. French quotation possible:

He said:
.FQ \(Fo
blablabla bla
blablabla blabla bla bla
blabla blabla bla bla
bla bla blablabla blablabla
blabla.\ \(Fc
.FQ
.QI

Email quotations are the same from a typographical point of view.

Perhaps you can `abuse' margin characters to implement a hack
(using properly defined margin characters `>',  `> >', `> > >',
etc.).
.QI

I wondered if you could divert the paragraph
using the current line length less \ew'> > '.
See how tall the diversion is.
Shove out that many `> > ' and the contents of the diversion.
.QI

Heh, that's just what I was thinking of.
It makes a number of assumptions about the content
of the diversion, though.

.QI >
But I've never played around with that side of things.
.QI

I've been idly thinking of adding a parameter to
the .in request to specify a fill character.
But I haven't looked at the code yet, and that
might scare me away.


.\" ----------------------------------------------------------------



reply via email to

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