Hi Ben, > I was looking to insert a question Num and then without a break indent > the question text. Similar to the IP command with a bullet, however, > I wish to append an additional mark allocation to the end of this body > text also without a break.
Attached is some source which has a go at what you describe. It's intended to be useful to study rather than just run. I developed it using nroff -ww ben.tr but it formats as PDF okay too with troff -ww -Tpdf ben.tr | gropdf >ben.pdf > So pointers to sources to read or inaccuracies in my thinking would > also be greatly appreciated. One terse resource with handy indexes at the start is Kernighan and Ossanna's CSTR 54. It also has a tutorial macro set at the end. https://troff.org/54.pdf Here's the nroff output of ben.tr. 0.........1.........2.........3.........4.........5.........6.........7.........8 _____ ____________________________________________________________ _______________________________________________________ Question goes here. Right i) Q1estion goes here. Right ii) Question goes here. Right iii) Another question. [2] iv) A much longer question. Far longer than before. 12 v) A much longer question. Far longer than before. 12 vi) This question takes several lines. Both in the input. And in the output. 123 vii) This question takes several lines. Both in the input. And in the output. 124 viii) This question takes several lines. Both in the input. And in the output. 125 ix) A question that doesn’t leave enough space for the marks to sit on the same line forcing a break. 123456 x) A question that doesn’t leave enough space for the marks to sit on the same line forcing a break. 1234567 xi) A question that doesn’t leave enough space for the marks to sit on the same line forcing a break. 12345678 xii) A question that doesn’t leave enough space for the marks to sit on the same line forcing a break. 123456789 xiii) A question that doesn’t leave enough space for the marks to sit on the same line forcing a break. 1234567890 xiv) Final question. 42 -- Cheers, Ralph.
.sp |1i .\" Leave adjustment on, even though it looks worse, because it's a .\" trickier prospect. .\" .na . .\" Diagnostic ruler. .po 0 .in 0 .ll 9i .ta 1i +1i +1i +1i +1i +1i +1i +1i .tc . 0 1 2 3 4 5 6 7 8 .tc .br . .\" The line starts after the page offset. .\" The indent eats into the line's length. .po 1i .ll 6i .in 0.5i \h'-\n(.iu'\l'\n(.iu'\" The indent. .br \h'-\n(.iu'\l'\n(.lu'\" The line length. .br \l'\n(.lu-\n(.iu'\" The line used for text: length less indent. .sp . . .\" Manually, without macros. Question goes here. .ds r Right \h'\n(.lu-\n(.iu-\n(.ku-\w'\*r'u'\*r .sp . . .\" Question number. .nr n 0 1 .af n i \" Complicate its width. . .\" Pose a question. .de q .ds n \\n+n)\\ \" Trailing unstretchable space. .if t .as n \\ \" Add another one for troff. .as n \c .nr ti 0-\\w'\\*n'u \" How much to move left by. \\h'\\n(tiu'\\*n .. . .q Q1estion goes here. .ds r Right \h'\n(.lu-\n(.iu-\n(.ku-\w'\*r'u'\*r .sp . . .\" Marks available. .de m .ds mk \\ \\$1 .cg .if \\n(gp<0 \{\ .br .cg .\} \\h'\\n(gpu'\\*(mk .sp .. .\" Calculate gap in gp. .de cg .nr gp \\n(.lu-\\n(.iu-\\n(.ku-\\w'\\*(mk'u .. . . .q Question goes here. .m Right . .q Another question. .m [2] . .q A much longer question. Far longer than before. .m 12 . .q A much longer question. Far longer than before. .m 12 . .q This question takes several lines. Both in the input. And in the output. .m 123 . .q This question takes several lines. Both in the input. And in the output. .m 124 . .q This question takes several lines. Both in the input. And in the output. .m 125 . .q A question that doesn't leave enough space for the marks to sit on the same line forcing a break. .m 123456 . .q A question that doesn't leave enough space for the marks to sit on the same line forcing a break. .m 1234567 . .q A question that doesn't leave enough space for the marks to sit on the same line forcing a break. .m 12345678 . .q A question that doesn't leave enough space for the marks to sit on the same line forcing a break. .m 123456789 . .q A question that doesn't leave enough space for the marks to sit on the same line forcing a break. .m 1234567890 . .q Final question. .m 42 . .sp 2 .pl \n(nlu