[Top][All Lists]

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

Re: How to align filled output line with tab stop?

From: Tadziu Hoffmann
Subject: Re: How to align filled output line with tab stop?
Date: Wed, 17 Nov 2021 16:44:27 +0100
User-agent: Mutt/1.11.4 (2019-03-13)

> However, I want the output to be like this:  I want the "Right" content
> of the second input line to be aligned with the second tab stop.  I also
> want the long "Middle" content of the second input line to be filled
> between the two tab stops.  Like this:
>       Left     Middle..............................................Right
>       Left     This is a very long string that will not fit in a
>                single output line and will have to break...........Right

This requires some serious troff magic.  The problem is that
the motion generated by tabs and leaders

  [...] is the distance from the current position on the
  _input_ line (where a tab or leader was found) to the
  next tab stop [...]

(Troff User's Manual section 9.1).

Nevertheless, the problem can be solved using diversions,
by delaying the interpretation of tabs and leaders until
the text has already been formatted.

It looks like you're trying to construct something similar to
a table of contents, so in case this might be illuminating,
here is a simplified version of my solution to that problem
from my own macro set.  I prefer wrapping the lines at a bit
less than the full width, in the example I've arbitrarily
set this to 4i (the full width is 5i).  The second tab exists
just to get the dots in different lines vertically aligned.

Description: Text document

Attachment: tocfmt.pdf
Description: Adobe PDF document

reply via email to

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