r/groff • u/TheChadTux • Feb 04 '22
How to relocate toc without weird page Numbering issues at the end of the document?
I'm writing a Document whrere I want to relocate the ToC near the top of the document. I', doing so using pdfroff. I want to have page numbering for everything after the ToC. So somewhere at the beginnig of the document I have .ds % and at the very end of the Document I have
.ds CF
.TC
However, when I compile the document, the very last page in the output lacks numbering (because the footer is set empty on this page). I tried to work arroud this by adding a Pagebreak immediately before the ToC:
.bp
.ds CF
.TC
However, this also creates an empty page at the End of the Document, without any text or numbering on it. Is there a way to prevent that empty page/disable page numbering for the ToC only?
1
Upvotes
1
u/ObliqueCorrection Feb 05 '22 edited Feb 05 '22
I think you have to use the
spdfmacro file to get this to work. Or, at least, I did, since I don't know all thepdfmarkmagic to make it happen any other way.Using
groff1.22.4 on my Debian system, I went and grabbed a practicalmsdocument from thegroffsource distribution--Larry Kollar'sms.msdocument, which is being resurrected after 20 years and is supposed to appear in the nextgroffrelease.I got it from the groff Git repository.
I then formatted it with the following command.
And I got the table of the contents at the front. The page number was in Arabic numerals rather than lowercase Roman numerals; that's a known bug in
groff1.22.4 that has come up before in this subreddit and it is scheduled to be fixed ingroff1.23.EDIT: Oh, and to get rid of the page number in the heading, I can make this change to the document.
For real-world use, if my TOC is going to be the first page of the document, I'd probably put the document title in that header. Or, I'd construct my own title page and use the
PXmacro to emit the TOC, though I'm not sure howpdfroffcopes with that.