Man Text – How to Word Wrap and Align Text Like Man Output

mantext;

what is the command that word wraps and justifies a text file so that the output looks like that of a man page:

   All of these system  calls  are  used  to  wait  for  state
   changes  in  a  child  of  the  calling process, and obtain
   information about the child whose  state  has  changed.   A
   state change is considered to be: the child terminated; the
   child was stopped by a signal; or the child was resumed  by
   a  signal.  In the case of a terminated child, performing a
   wait allows the system to release the resources  associated
   with the child; if a wait is not performed, then the termi-
   nated child remains in a "zombie" state (see NOTES below).

Best Answer

That would be GROFF.
(Older Unix version use NROFF or TROFF, but they are all different programs in the same family.)

Please note that it is not a simple command that operates on a text-file. It requires formatting instructions to be inserted in the text.
In fact it operates much more like a compiler.
If you are familiar with TeX or LaTeX than you know the principle, but the various ROFF style programms have a much simpler command language.

Related Question