[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Groff] Hanging paragraphs in MM
From: |
Ted Harding |
Subject: |
RE: [Groff] Hanging paragraphs in MM |
Date: |
Tue, 01 Jun 2010 12:14:24 +0100 (BST) |
On 01-Jun-10 10:19:17, Anton Shepelev wrote:
> Hello, all
>
> I often need to typeset single hanging paragraphs like:
>
> PS: Example of a post-scriptum, it has a hanging
> indent.
>
> I have created a macro for this, which
>
> 1. Calculates the length of the label and
> increments it by one,
>
> 2. Begins a variable-item list (MM's .VL) with
> the calculated indent,
>
> 3. Typesets the desired paragraph as one list
> item (MM'c .LI),
>
> 4. Ends the list (MM's .LE).
>
> But to use it, I have to pass both label and text
> as macro parameters, while I'd like to pass only
> the label and have the text on the next input line
> (like it is done in MAN's .TP macro, for example).
>
> Could you please suggest a way of doing it? Maybe
> I better emulate it using groff's requests (and
> take care not to meddle with MM's inner logic)?
>
> Thanks in advance,
> Anton
This is handles nicely in MS macros (see below). Unfortunately,
it would seem that the MM macros only allow for two types of
paragraph:
Type 0: first line left-justified
Type 1: first line indented (indentation set in a register)
(Also Type 2 but this is basically the same as Type 1).
In MS macros, you would use ".IP" for an indented paragraph,
with 1 or 2 arguments. The first is the "tag". The second,
if present, is the amount of indenting (in n's) to use. So you
could do the following:
.IP "PS: " (n; \w'PS: ')
This is a hanging paragraph.
This is a hanging paragraph.
This is a hanging paragraph.
This is a hanging paragraph.
This is a hanging paragraph.
This is a hanging paragraph.
That would produce a result like:
PS: This is a hanging paragraph. This is a hanging
paragraph. This is a hanging paragraph. This is
a hanging paragraph. This is a hanging paragraph.
This is a hanging paragraph.
The indentation has been calculated to allow room for "PS: ",
since otherwise (if the default indentation were smaller) the
tag "PS: " would be on a line by itself, with everything that
follows being on indented lines using the default indentation.
If you want to write your own macro to produce a similar effect,
you could maybe base it on the code which follows "@IP" in the
file .../tmac/s.tmac
One "hack" which might lead to what you want is to calculate an
indent based on the width of the tag "PS: ", and then increment
the line-indentation once the paragraph has been started (but
you would need to reset it at the end of the paragraph):
(Note the use of the unstretchable space "\ "). With Type 0 para:
.nr indnt \w'PS:\ '
.P
PS:\ This is a hanging paragraph.
.in +\n[indnt]u
This is a hanging paragraph.
This is a hanging paragraph.
This is a hanging paragraph.
This is a hanging paragraph.
This is a hanging paragraph.
.br
.in -\n[indnt]u
Hoping this helps!
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 01-Jun-10 Time: 12:14:22
------------------------------ XFMail ------------------------------