Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was going to ask why one would prefer groff to some TeX variant. Speed is a pretty good reason; I'm impressed at how slow TeX is even on modern hardware. I usually generate HTML unless I want something beautiful, and then I usually use ConTeXt. I'm pretty fond of classic Unix stuff so maybe I'll delve more into groff.


I've read _The TexBook_ and other material but just find the TeX mark-up so noisy to parse compared with the troff style of `.cmd' at the start of the line, cmd is often short, with the odd bit of \s+2 embedded within the line, depending on personal preference.

troff and friends were developed on Unix in its early days by the originators of Unix and it shows in what a good fit they are to the environment and in their elegance; they are Unix programs. TeX was born outside of Unix; it runs on Unix.


Feel like answering a couple more questions? :) The kinds of questions I have are not "good" questions for S.O. I'm tempted to try redoing a project of mine from ConTeXt in troff just to see what it's like. Do you recommend any particular macro package? Without any other input I'd probably try the -me macros, just because they've been compared to Pascal (versus the FORTRAN of -ms and the PL/1 of -mm).

Also, do you find yourself writing your own macros much? I haven't the faintest idea what that would require with troff, but I rely on this with TeX quite a bit, mostly to elevate stylistic markup into semantic markup. My impression is that if you want semantic macros you use a macro package, and even then you probably freely intersperse non-semantic macros.

This project I've been working on for a while, uses LuaTeX so that I can connect to a local database, perform some queries and typeset them and their output. I imagine this kind of thing would not be difficult to do directly with a custom pipeline step using troff. Have you done that kind of thing before? If so, how unpleasant was it?

Thanks for talking with me about this.


You'd do well to ask these on the https://lists.gnu.org/mailman/listinfo/groff list for a wider set of opinions. It depends on the style and complexity of the document. -ms is simple enough that people like W. Richard Stevens would tweak it for their books. I understand the relative newcomer, -mom, is comprehensive, modern, and well supported by its author on the above list. I don't recognise the Pascal, etc., analogies. :-)

I do write my own macros. They can be just short-hands for a combination of others in the same way my ~/bin/l is exec ls -l "$@", or sometimes for a simple document I start with just troff and have some macros on top of that. Yes, any distinction over semantics is purely convention.

You may wish to read Kernighan's _Nroff/Troff User's Manual_, http://troff.org/54.pdf, otherwise known as CSTR #54. It's original troff, not groff, but as a succinct reference with elegant prose we often refer back to it. At the end is a tutorial introducing simple macros.

Integrating troff and friends in pipelines and scripts is easy. They take line-based text as input and produce it as output, only switching to binary for some output formats at the last hop. You can also run system(3) from within troff documents, e.g. to include the output of a command, but often that's not the easiest fit.

I recommend again the groff@gnu.org list; they're friendly, patient with newcomers, and interested in showing how they tackle the task at hand.


As it happens, the analogy is from the Unix Text Processing book, page 97: "Mark Horton writes us: I think of ms as the FORTRAN of nroff, mm as the PL/I, and me as the Pascal."

Thank you for taking the time to answer these questions! I will plough through some of this documentation and make my way over to the list.


+1 on speed and memory.. Some table and figure heavy documents I've done have had internal memory overruns on latex.

A lot of my forays into programming started with the Bell Labs books (with troff | pic | eqn ...) prominently on the copyright page. So, it was one of the first things I looked up when I got access to a UNIX terminal. Then I discovered that all the UNIX books by Stevens were done up with troff/groff. From there, it was all "steadily downhill" for me ;-)

P.S: If you already know (La/Con)TeX then groff is literally a walk in the park. And it is always good to know more than one way to do things imho. Good luck with it.


My knowledge of ConTeXt is pretty limited, but unlike LaTeX you don't need to be an expert to get good looking results. I find ConTeXt a lot more intuitive.

I got a book on TeX coming soon because I want to get better at ConTeXt. ConTeXt is not shy about telling you that for better results you need to understand TeX and use it appropriately. I find it kind of absurd that I've been using TeX for so many years without actually understanding it.

I have been curious about roff since trying to use Plan 9, but in a pretty absent-minded way. They're quite unashamed of providing roff at the expense of TeX, and I believe all of its documentation is roff-formatted, including the technical reports, but I could be mistaken about that.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: