groff
[Top][All Lists]
Advanced

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

[Groff] problem with nested diversions


From: Steve Izma
Subject: [Groff] problem with nested diversions
Date: Fri, 15 Aug 2008 19:18:40 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

I can't figure out how a nested diversion fits into the text flow
when its parent diversion is being output. The calls for the
macro containing the nested diversion seem out of place relative
to the text flow.

I emulate the problem with a single block of text captured into
diversion "a"; it contains calls to a pair of footnote macros
that need to capture the text between them for positioning at the
bottom of the page (or after the main diversion has been output).

For reasons outlined at the end of this message (which gives
the details of the project where this problem arose), I can't
process the footnote when the parent diversion is being read; it
must only be processed when the diversion is being output. And
so I re-embed the pair of macro calls in the text with "\!". But
when the macros are finally called on the output of the parent
text, they don't properly capture the footnote text that they had
originally surrounded.

Here's the text sample (complete sample is attached, along with a
PDF of the output):

.di a
Even without publication, Nightingale's \fISuggestions for
Thought\fP attracted much scholarly attention. Several editions
of excerpts have been published. Three books of excerpts, and a
separate edition of ``Cassandra,'' were published later in the
twentieth century.\c
.fn(( 1
Michael D. Calabria and Janet A. Macrae, eds.,
\fISuggestions for Thought by Florence Nightingale\fP.
.fn))
As usual the official biography, E.T. Cook's \fIThe Life of
Florence Nightingale\fP, can be counted on for excellent
background on the purpose and writing.
.br
.di
.nf
.a
.sp
.fnote

The two footnote macros test to see if they're inside diversion
"a"; if so, they set the superior figure, which should follow
immediately after the last word of the text before the macro call
(i.e., "century"). Then they embed a call to themselves before
quitting:

.de fn((
.ie '\\n[.z]'a' \{\
.       nop \s-2\u\\$1\d\s0
.       nop \!.fn(( \\$@
.\}
.el \{\
.       ev note
.       di fnote
.       nop \\$1.
.\}
..
.de fn))
.ie '\\n[.z]'a' \!.fn))
.el \{\
.       br
.       di
.       ev
.\}
..

The output shows the following fragment captured in the
diversion "fnote":

        dra,'' were published later in the twentieth century.1
        Michael D. Calabria and Janet A. Macrae, eds., Sug-

This is printed at the bottom of the page. The text block itself
is interrupted at "Cassan-" and then continues with:

        gestions for Thought by Florence Nightingale
        As usual the official biography, E.T. Cook's ...

so no text actually goes missing.

It appears that the captured text is part of a re-formatted input
stream, starting immediately after the last full output line
rather than at the position where the embedded macro is called.
The parent diversion is being output in no-fill mode.

Any ideas?

I'm using groff 1.18.1 on a Debian system.

Why do I need this?

I have a project that requires two columns per page, but each
column is a separate flow of text, like a table with two text
blocks side-by-side. The left column represents an original
manuscript and the right column the published version. (It's
actually much more complicated than this, but I don't think the
additional details make a difference in this problem.)

Because of the differences in the text, the blocks are rarely the
same size. But when the texts come back into sync, they need to
both start in the same vertical place on the page, just like a
new row in a table.

If the left block runs past the bottom of the page, its run-over
contents need to be captured in a diversion and kept until the
right block is printed on the current page. At the start of the
next page, the remains of the left block are output first before
the next pair of blocks is processed.

The problem arises when a footnote occurs in the diverted remains
of the left block. I don't want the footnote to be added to any
collection of footnotes from the previous page, so I re-embed the
pair of macro calls in the text with "\!". But when the macros
are finally called on the output of the remains in the next page,
they don't properly capture the text that they had originally
surrounded, as shown above.

I could probably process the footnote while the remains are
being diverted by putting it into a separate diversion from
all the ones that will actually be output on the current page.
Then I would use that separately diverted footnote to start the
collection of notes for the next page. This would avoid the need
for embedding the footnote macros. But I still hope that the
simpler method outlined above can be made to work, or at least I
hope I get an explanation for its behaviour.

        Thanks,
        -- Steve

-- 
Steve Izma
    Computing Systems Administrator       519-884-0710 ext. 6125
    Wilfrid Laurier University Press      FAX: 519-725-1399
    Waterloo, Ont., Canada N2L 3C5        address@hidden

Attachment: text3
Description: Text document

Attachment: text3.pdf
Description: Adobe PDF document


reply via email to

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