groff
[Top][All Lists]
Advanced

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

Re: [Groff] Formatting algorithm


From: Ted Harding
Subject: Re: [Groff] Formatting algorithm
Date: Wed, 23 Apr 2014 22:42:27 +0100 (BST)

I think some confusion is possibly arising here. See in-line below.

On 23-Apr-2014 20:45:10 Keith Marshall wrote:
> On 22/04/14 20:40, Peter Schaffter wrote:
>> On Tue, Apr 22, 2014, Ulrich Lauther wrote:
>>> Well of course not.  A paragraph ends, e.g. when an empty line is
>>> seen.  Probably there are a whole lot of other conditions.  My
>>> understanding is that formatting takes place after macros have
>>> been expanded; at the macro level it would be easier.  So could
>>> the macros issue some hint (in form of a pseudo comment) when they
>>> realize that a paragraph has ended?
>> 
>> Signalling the end of collected paragraphs can't be done exclusively
>> within macros because, unlike SGMLs, paragraph macros in groff
>> generally aren't closed.
> 
> Doesn't a paragraph logically conclude at any request which introduces a
> break?  Or invocation of any macro which itself invokes such a request?
>  (In addition to an empty input line, or one with leading white space,
> which implies a break?)  All of these exhibit one common feature: the
> introduction of the break.

I think I have to disagree here. For example, in the middle of a
paragraph I may wish to put some text centred on lines by itself,
and this may be in the middle of a sentence -- perhaps a parenthetical
quotation. Or, in technical writing, a displayed equation in the
middle of a sentence.

Such things certainly induce a line-break (indeed two) but they
can hardly constitute a separate paragraph (unless one's concept
of "paragraph" allows the same sentence to continue through two
or more "paragraphs"). So I don't agree with Keith that "the
introduction of the break" denotea a new paragraph. A line-break
is necessary, but not sufficient, for the end of a paragraph.

In groff, the paragraph requests in the various macro packages
invariably have as their first action "closure" of the preceding
paragraph (if any), followed by by the initialisation of the new
paragraph.

What people seem to be discussing here is the need to mark the end
of the current paragraph in order that groff may have a defined
chunk of stuff which it already knows is a whole paragraph before
setting about formatting it as a whole.

This could be achieved in at least two ways:

[1] The current paragraph is in a diversion, and the start of the
paragraph macro includes the closure of the preceding paragraph
(if any) and referral of the (now closed) diversion to the "format
paragraph as a whole" process.

[2] A separate request "end paragraph" (e.g. ".EP") which does this,
but does nhot depend on choice of macro for the next paragraph.

And this seems to be essentially what Peter is describing below.

Best wishes to all,
Ted.

>> That means that every macro introducing a new semantic element would
>> have to test, at the start of the macro definition, whether paragraph
>> collecting is currently taking place, and bring it to an end so the
>> paragraph can be formatted. While that would work in a lot of cases,
>> I think the better strategy would be to implement two requests, say
>> .pb and .pe, usable within macro definitions, but also available
>> on-the-fly in cases where the user needs to specify the block of text
>> that constitutes a paragraph.
> 
> Of course, in the interests of semantic markup, it may be useful to have
> a macro which would explicitly mark the end of a paragraph, but would
> such a macro not be a semantic element of the particular macro package
> which provides it?
> 
> -- 
> Regards,
> Keith.

-------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Date: 23-Apr-2014  Time: 22:41:58
This message was sent by XFMail
-------------------------------------------------


reply via email to

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