groff (GNU troff)

As these guides are created for groff, I cannot guarantee that they are applicable to troff. If you use troff and can confirm them to work for it – please let me know.

Apart from groff, these guides may include other programs used together with groff, such as eqn, tbl, and so on. I will try to make this clear in the description of each guide.

Collection of papers on troff and its companions

Following is a collection based on However, I found that much of the links referenced from that site are dead. I have instead downloaded and compiled pdfs from Much of the material available was written at Bell Labs. The CSTR documents below refer to ’Computer Science Technical Reports’, a Bell Labs internal numbering system used in the past.


macro packages






Crossing out expressions in eqn

In the man page of eqn you can read about defining a macro for canceling an expression. This macro draws a line over the expression, as an indication it’s canceled. When using paper and pen I usually use a cross instead, so this is how you do the same in eqn.

.\" define cancel_cross macro for expressions 
.defcolor cancelcolor rgb 0.0f 0.0f 0.0f 
.EQ } 
define cancel_cross ’special Cax’ 
.de Cax 
.  ds 0s \ 
\Z’\D’t 0.75p’’\ 
\D’l \\n(0wu -\\n(0hu-\\n(0du’\ 
\D’l \\n(0wu \\n(0hu+\\n(0du’\ 
\Z’\D’t 0.5p’’\ 

Then use it for example like this: { 4 times 1 } over { 4 times 5 } = { cancel_cross 4 times 1 } over { cancel_cross 4 times 5 }.

You can of course name your macro cancel instead of cancel_cross. The cancelcolor is also optional, and in the case above redundant.

Simplify expressions in eqn

When writing eqn expressions in groff it’s easier to distinguish what is groff and what is eqn using distinct delimiters for eqn. This is simply accomplished this way:

delim ## 

Then use it like this:

Calculate the sum of #-4# and #-7# 
.sp 1 
# (-4) + (-7) # 
# = -4 - 7 # 
# = -11