Style & Grammar

The utilities bundled with the historical UNIX Writer's Workbench also allow for grammar and style-checking of mdoc documents — indeed, any document.

Like with spelling, these utilities cannot handle mdoc constructions. Unlike spelling, grammar depends on correct flow of terms. To wit, one must fully process input mdoc documents before passing them to such checks.


The diction utility is rarely distributed with default UNIX operating systems, although it may be separately downloaded. The input to diction is best when it consists of well-formed sentences, which only appear when manuals are post-formatted.

mandoc file.1 | col -b | tail -n+2 | diction

Alternatively, with nroff:

nroff -mandoc file.1 | col -b | tail -n+2 | diction

This first strips the text decoration (underlined and bold text) from nroff or mandoc with col. The header is then stripped with tail. Finally, the formatted output is fed to the diction utility, which analyses text for readability.

Last edited by $Author: kristaps $ on $Date: 2011/11/04 01:06:28 $. Copyright © 2011, Kristaps Dzonsons. CC BY-SA.