[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to write man pages (Re: Man pages ksh.)

Majestic One writes:
> How would I begin writing man pages?

Man pages are written using a macro package (formerly "man"
(pre-BSD4.4), now "mdoc") for a typsetting language called troff.

To learn it, start by reading mdoc.samples(7); that is, type:

  man mdoc.samples

See also: mdoc(7), and groff(1).

I like to simply copy an existing similar man page and edit that.
Look at /usr/src/bin/cat/cat.1 which is the manpage for cat(1).

Also, this stuff isn't online because of copyrights, but the User's
Supplementary Docs (USD) book of the BSD 4.4 manual set, chapters
21 and 22 contain a whole discussion of and a tutorial for Troff.
You shouldn't need that depth of coverage, but it helps to know
about simple troff commands such as .br for doing line breaks, etc.

Shame about the copyright.  I don't know where else a soul can learn
about the basic troff commands.