groff file.troff -step -k > file.pdf
And you can now enjoy a formated book in the spot.If any, check Groff with Mom macros, with does what you need with ease:
Online manual:
https://www.schaffter.ca/mom/momdoc/toc.html
For a quick command:
pdfmom -step -k yourfile.troff > output.pdf
In order to get the last version:- Install groff in Hyperbola GNU/Linux (or any other) if is not installed. It's mandatory in a 99% of distros but not Hyperbola.
- get https://www.schaffter.ca/mom/mom-2.6_d.tar.gz
- uncompress it
- copy om.tmac to /usr/share/groff/current/tmac/om.tmac
- cd to examples/ directory and do some tests:
pdfmom -step -k mom-pdf.mom > mom-pdf.pdf
WIth jstar+groff+mom you can get something basically perfect.
"-step -k" it's just "-s -t -e -p -k", a bunch of options to enforce UTF-8,
some proper handing and whatnot.