> 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.
.\" .\" ---------------------------------------------------------------- .ds L This is a very long string that will not fit in a single output line and will have to break .\" ---------------------------------------------------------------- .char \(.. \0.\0 .lc \(.. .\" ---------------------------------------------------------------- .de BT .di TC .in 1i .ti -1i .ll 4i .ta 1i .fi .ad l .hy 0 \\$1\t\c .. .\" ---------------------------------------------------------------- .de ET .ta 1i \w'\\$1'u%\w'\(..'u+5i-\w'\\$1'u-\w'\(..'u 5iR \\a\\t\\$1 .br .di .in 0 .nf .TC .. .\" ---------------------------------------------------------------- .po 1i .sp 2i \D'l 0 -1m'\D'l 1i 0'\D'l 0 1m'\v'-1m'\D'l 3i 0'\D'l 0 1m'\v'-1m'\D'l 1i 0'\D'l 0 1m' .BT First Middle .ET 1 .BT Second \*L .ET 1234567
tocfmt.pdf
Description: Adobe PDF document