groff
[Top][All Lists]
Advanced

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

Re: [Groff] Headers in MM


From: Mike Bianchi
Subject: Re: [Groff] Headers in MM
Date: Wed, 28 Apr 2010 10:09:41 -0400
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

Anton,

Since HX, HY and HZ are initialized as empty, and hence no-ops, using them to
do anything that works for you is just fine.

The one thing to be careful of is using knowledge of the implementation
obtained by reading the code.  Any of that can be changed.

In this case, you use the  }0  string, which is documented in the code
(file m.tmac) as being available for use within a user-provided  HX  macro.
I'd say you are very safe there.

Using  a  as the name of a number register is more risky as it could easily
conflict with another temporary register elsewhere.  groff supports long
names and that helps avoid collisions.  (See register  temp_indent_  below.)
(I always use the  \*[name],  \n[name],  etc.  style of reference, even for
1- and 2-character references.  They stand out better and all references
look alike.)

In playing with your example, I found that it was nroff specific, since
 .length  gives a character count and your indent and outdent are in terms
of  n  units.  The following also works in troff/groff.  It obtains the
width of the  }0  mark in troff/groff's "units" (aka "scaled points")
from the  \w'string'  escape sequence, and then uses it that way.

        .de HY
        .nr temp_indent_ \\w'\\*[}0]'
        .in +\\n[temp_indent_]u
        .ti -\\n[temp_indent_]u
        .nr ;0 2
        ..
        .de HZ
        .in 0n
        .br
        ..
        .
        this is a test
        .H 1 asdfjkl asdfjkl asdfjkl adfjkl adfjkl adfjkl adfjkl sdkfjasldfkj \
        sdkl sdfal sdfjkasdfjkl asdfjkl sdfjkl ajkl asdfjkl asdfjkl asdfjkl \
        adfjkl adfjkl adfjkl adfjkl adf
        this is a test

                                                        Mike


On Tue, Apr 27, 2010 at 11:27:02PM +0400, Anton Shepelev wrote:
> Hello all,
> 
> When  I saw how MM formats headers the first thing
> that stroke me was the lask of hanging indent  for
> multiline headers, so I did these little modifica-
> tion:
> 
>       .de HY
>       .length a \\*(}0
>       .in +\\nan
>       .ti -\\nan
>       .nr ;0 2
>       ..
>       .de HZ
>       .in 0n
>       ..
> 
> It produces headers like this:
> 
> 
> 1.  This is a very long hearer. Note the hanging
>     indent.
> 
> 
> I'd like to ask you whether this  modification        is
> ideologically correct and whether it won't produce
> undesirable side effects.
> 
> Thank you in advance,
> Anton

-- 
 Mike Bianchi
 Foveal Systems

 973 822-2085   call to arrange Fax

 address@hidden
 http://www.AutoAuditorium.com
 http://www.FovealMounts.com




reply via email to

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