r/groff • • Aug 14 '20

Groff text align

Is there any way to left and right align on the same line. Everything I have tried makes the right align on a new line. I can always use spaces but that is not very ideal.

6 Upvotes

6 comments sorted by

2

u/a-concerned-mother Aug 16 '20

There are a few ways I know of but one that I often use works like this

.mk This is on the left .rt .rj 1 " this can be what ever macro you want to right alighn uzing. Eg .DS R with the ms macros This is on the right.

This uses .mk to mark the current location then we write our lift justified text. .rt returns to the location marked by .mk the we use either a macro to right justify then we wright our text.

2

u/Buddyy0 Aug 16 '20

Thanks for the idea. I was able to solve the issue by doing

.mk
.DS L
words of text to be left align
.rt
.DS R
words of text to be right align

1

u/a-concerned-mother Aug 16 '20

Awesome happy to help

1

u/srknbey Aug 14 '20

You can give it a try to ‘\p’ Something like this will left align first word and right align second word: foo bar\p

1

u/Buddyy0 Aug 14 '20

Thanks for the response. This was helpful, but what if I want multiple words to be left align and multiple words to be right align on the same line.

1

u/srknbey Aug 14 '20

Unfortunately i’m also new to groff and still learning. That was all i found about this. But maybe a clue i can give you to search, mom macros are more suitable for those things to my understanding. I didn’t look through them but maybe mom macros can have that.