groff
[Top][All Lists]
Advanced

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

Re: [MS] Split Header


From: G. Branden Robinson
Subject: Re: [MS] Split Header
Date: Sun, 17 Dec 2023 14:28:12 -0600

Hi Wael,

Bad news first.

At 2023-12-12T17:30:15+0200, Wael Karram wrote:
> I'm trying to get a split header much like say in a classic mail card
> where you'd have some details on the left and parallel to them other
> details on the right - this is using the ms macro set.
> 
> In the past I used something like this:

> .mk
> .DS L
> Left-aligned side
> .DE
> .rt
> .DS R
> Right-aligned side
> .DE

> Now, it doesn't work anymore after a recent groff update.

"Something like", but not exactly, I have to conclude: the foregoing
example does not work as you seem to desire on any of groff 1.22.3,
1.22.4, or 1.23.0, which covers about nine years.

> What ends up happening is that indeed the text is aligned as intended
> - but on different consecutive lines.

Given the above example, the left- and right- aligned material never
occupies the same output line for me.  There is a change in the way
things align from 1.22.4 to 1.23.0, but it's simply different, not
necessarily better or worse.

By using low-level *roff requests to alter the drawing position, I think
you may be changing the state of the formatter out from where the ms
macro package expects it to be.

I had a look with Heirloom Doctools troff and ms, but quickly gave up
because that ms doesn't support right-aligned displays at all.

(For what it's worth, it doesn't overprint the two displays either, so
once again they're on different lines.)

> Omitting the DEs makes it work as intended, but gives a warning about
> unterminated DSes.

The warning sounds valid to me.  This seems like an accidental success
and not something that will be generally useful.

> Is there any other way to achieve what I am looking for? I have tried
> searching to no avail.

Now for the good news.

The `tl` request was made for this sort of thing.

$ cat ATTIC/wael2.ms
.LP
.tl 'Left-aligned side''Right-aligned side'
$ ~/groff-1.22.3/bin/nroff -ms -Tascii ATTIC/wael2.ms|cat -n|head
     1
     2
     3
     4
     5
     6
     7  Left-aligned side                         Right-aligned side
     8
     9
    10
$ /usr/bin/nroff -ms -Tascii ATTIC/wael2.ms|cat -n|head # groff 1.22.4
     1
     2
     3
     4
     5
     6
     7  Left-aligned side                         Right-aligned side
     8
     9
    10
$ ~/groff-stable/bin/nroff -ms -Tascii ATTIC/wael2.ms|cat -n|head # 1.23.0
     1
     2
     3
     4
     5
     6
     7  Left-aligned side                              Right-aligned side
     8
     9
    10
$ nroff -ms -Tascii ATTIC/wael2.ms|cat -n|head # groff Git HEAD
     1
     2
     3
     4
     5
     6
     7  Left-aligned side                              Right-aligned side
     8
     9
    10

So that might work better for you.  Remember to call a paragraphing or
sectioning macro to start your ms document, as I did with `LP`.

Yes, `tl` is a low-level request too, but not as disruptive to the state
of the formatter.  It writes an output line and gets out of the way.

(The default line length in ms(7) did change in groff 1.23.0.  This is
documented.[1])

Regards,
Branden

[1] NEWS:

o The s (ms) macro package now uses a default line length of 6.5 inches
  by default, resulting in 1-inch left and right margins.  When the
  "papersize.tmac" package is used by employing the "-d paper" groff(1)
  option on typesetting devices, the default page offset and line length
  are adjusted to maintain these margins.

Attachment: signature.asc
Description: PGP signature


reply via email to

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