24

I've heard that troff/groff have largely been replaced by TeX. Is this true?

The only thing that I know actually used troff nowadays is manpages. Is this also true? If not, what are some other uses?

strugee
  • 14,723
  • 17
  • 73
  • 119
  • 3
    Not just `TeX` but also `HTML`. – jordanm Sep 06 '13 at 05:18
  • 15
    I would consider the fact that man pages still use *roff to make it relevant. – Chris Down Sep 06 '13 at 07:58
  • It's kinda open up to opinion. Nowadays, people often use Markdown and ReStructuredText and use `pandoc` to convert it into manpages or HTML. Especially ReStructuredText lends itself very well to make it into various kinds of documentation. – polemon Nov 16 '21 at 23:54
  • 1
    If troff/groff still work, anybody can use it. There are several advantages to an "embedded controls" document formatter over a WYSIWYG (What You See Is All You Get) formatter. Using IBM's `script` formatter, I wrote a tool that let us cross-reference test cases and assertions in the specification document, identifying high value tests. One cannot even _think_ about doing this with a WYSIWYG formatter. (Well, one could, by doing binary I/O on a proprietary, undocumented blob. No thanks!) troff/groff are tools in everyone's toolbox, and could be just the thing for The Next Project. – waltinator Nov 17 '21 at 00:55
  • 1
    If I may say so, whilst the body of the question is fine, the title itself *seems* to invite opinions rather than factual answers. – Greenonline Feb 22 '22 at 12:44
  • @Greenonline upvoted because you're right :P feel free to suggest a reworded title. – strugee Feb 28 '22 at 15:49

8 Answers8

30

I am using troff for my everyday typesetting; I am using the Heirloom version of troff (see http://heirloom.sourceforge.net/doctools.html ) which has very powerful support for fonts (TTF, Type1, OTF, etc.), Knuth's algorithm for formatting the paragraph as well as several micro-typesetting features that you can't find in plain TeX; it is lighter than LaTeX and as long as you don't need to typeset equations, I find it much easier to get high-level typesetting than with LaTeX (it's much easier to load fonts, get control over the exact position of things, etc.).

Thomas Baruchel
  • 1,143
  • 1
  • 8
  • 14
26

I run/schedule 'canned' PDF reports using *roff, generating tables and simple PICs as I process the data with python, and organizing sources with simple bash scripts. Smooth & Simple.

Like vi, *roff is always there, ready-to-run and generates clean PDFs with minimal fuss. I like *roff's terse markup.

This said, I don't pretend to be a representative sample of typesetter/mark-up users...

user2105469
  • 361
  • 3
  • 3
  • Mmm. I'd not thought of using *roff to create PDFs. (It's been a (very) long while since I last used nroff for anything.) Must revisit that as a possible solution for a project I have in mind. Unless HTML solves it sensibly, too. – roaima Apr 02 '15 at 15:00
  • 1
    I think the combination of R-Inkscape and `*roff` is particularly powerful if the objective is to generate PDFs write-ups. Inkscape touches up R's graphs (exported as PDF although PS/EPS also works), and PDF Studio (or any other PDF editor) makes graph inserts a simple copy-paste deal. You can script `tbl` inputs with the language of your choice and update your doc with bash/make. This is the pipe I use: – user2105469 Apr 02 '15 at 15:27
  • 3
    `tbl myreport.roff | eqn | groff -Tps -ms | ps2pdfwr - myreport.pdf` – user2105469 Apr 02 '15 at 15:27
15

A very successful Addison-Wesley book published in 2015, The Go Programming Language, was typeset in troff/groff.

You can read about the rationale in this blog post by a blogger who sought to inquire about the lovely typesetting.

pestophagous
  • 312
  • 2
  • 8
  • 1
    The link to the blog seems to be no longer working, but this archive link does: https://web.archive.org/web/20220331113712/https://rkrishnan.org/posts/2016-03-07-how-is-gopl-typeset.html – heiner Jun 12 '22 at 21:24
14

I've heard that troff/groff have largely been replaced by TeX. Is this true?

The only thing that I know actually used troff nowadays is manpages. Is this also true?

I've only ever seen troff/groff being used for manpages; for everything else, people seem to use TeX or LaTeX. So I'd answer yes and yes.

If not, what are some other uses?

Apparently it was used to typeset books back in the day: http://www.troff.org/pubs.html
As that page was last updated in 2006, I don't think that it's still being used for this purpose :)

Martin von Wittich
  • 13,857
  • 6
  • 51
  • 74
  • 5
    -1 to this answer. Troff is still used for authoring documentation across a variety of mediums, and even manpages aren't strictly formatted only for TTY display. As for TeX, yes, it's true it replaced Troff as the dominant language for technical publishing (Roff's hairier-looking syntax probably didn't help here), but both languages are equally powerful and extensible. –  Mar 19 '18 at 13:03
  • 1
    I've been using groff since [Pandoc](http://pandoc.org) enabled the ms macros for pdf output (via pdfroff). So, basically, I dumped LaTeX. Not without hesitation, though. – jarnosz Nov 16 '21 at 23:12
6

I still use it with its ms macros for internal technical reports/documentation of very specific projects, not only groff but also even PIC for basic block flowchart layouts. It is also easy to incorporate custom postscript graphics or charts generated with the GNU Plotutils. Automated PDF reports are also easy to build by using groff.

I doubt it is widely used anymore but it works well for preparing simple documentation and reports and the fact that there are some answers here shows that there might be more people using it than we thought.

M.E.
  • 589
  • 4
  • 14
4

*roff was used at Collins Dictionaries until the early 2000s to typeset printed dictionaries. I was part of the team that worked on *roff workflows and migrated them to newer alternatives.

1

G/Troff can do almost everything that (La)TeX can; it's just that few people use it nowadays.

If you're going to be submitting PDFs then you might as well use Troff and benefit from its UNIX philosophy, but if you have to share source code then you may have to use LaTeX.

kleinbottle4
  • 185
  • 6
  • That's a **hard** oversell of Groff/Troff. No, it can not nearly do all that TeX can. That in itself might be a feature, but you won't be setting any publication-grade multidimensional plots with groff anytime soon. – Marcus Müller Aug 26 '23 at 22:34
-1

I think LaTeX is more of a markup language that automatically outputs the text based on style selections, while troff allows more precision but has less automatic style support. You can use both for either task, but I think each has its favored use. I use groff when I need precise text positioning.

  • that is not true. LaTeX is anything but a markup language – it's more of a self-parsing parser configuration language with "document output" as side effect. LaTex is definitely a programming language and very little a markup language. Sure, there's some commands in standard LaTeX that specify document structure, but the abstraction that they just describe properties of a text segment is too leaky even for very superficial usage. – Marcus Müller Aug 26 '23 at 22:36