Subject: Re: what man(1) reads
To: James K. Lowden <jklowden@schemamania.org>
From: Perry E. Metzger <perry@piermont.com>
List: netbsd-help
Date: 06/15/2002 16:55:21
"James K. Lowden" <jklowden@schemamania.org> writes:
> I'm using txt2man, and it's producing some not-quite-right output.  I want
> to tweak it, but I can't seem to find the nroff (?) macros that man pages
> use.  
> 
> I've read the mdoc stuff, but of course that describes mdoc input, not
> mdoc output.  
> 
> For instance, I'm looking at txt2man output like:
> 
> 	.SH NOTES
> 
> 	To date, freebcp has been tested ...
> 	.TP
> 	.B
> 	When connecting to ...
> 
> and I don't know where to read about .B and friends.  

I'm not sure I understand your question entirely. mdoc output is human
readable text. Perhaps you are confused about what the mdoc and man
macros are.

Unix manuals are written with ?roff macro packages. Older
(i.e. traditional) unix man pages are written in the "man" macros. BSD
switched a long time ago to the newer "mdoc" macros. You run the
document through troff or nroff, tell it "-man" or "-mdoc" and it
produces appropriate human readable text.

It appears that the tool you are using (txt2man) produces old-style
man macro formatted sources as output.

There is no documentation in NetBSD itself for the man macros, but I
happen to have the following man page around from the CSRG Final
source tree. Just cut it out and run it through "nroff -man" to format
it.

Don't worry about the copyright, btw -- Caldera released all this code
some months ago so it isn't really a violation for me to post it.

cut here for man.7 ----------------------------------------------------
.\" Copyright (c) 1986, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This module is believed to contain source code proprietary to AT&T.
.\" Use and redistribution is subject to the Berkeley Software License
.\" Agreement and your Software Agreement with AT&T (Western Electric).
.\"
.\"	@(#)man.7	8.3 (Berkeley) 6/1/94
.\"
.TH MAN 7 "June 1, 1994"
.AT 3
.SH NAME
man \- (deprecated) macros to typeset manual
.SH SYNOPSIS
.B
nroff  \-man\ 
file ...
.PP
.B
troff  \-man\ 
file ...
.SH DESCRIPTION
These macros were used in the past to lay out pages of this manual.
A skeleton page may
be found in the file /usr/share/misc/man.template.
The new macros are in mdoc(7).
.PP
Any text argument
.I t
may be zero to six words.
Quotes may be used to include blanks in a `word'.
If 
.I text
is empty,
special treatment is applied to
the next input line with text to be printed.
In this way
.BR . I
may be used to italicize a whole line, or
.BR . SM
may be
followed by
.BR . B
to make small bold letters.
.PP
A prevailing indent distance is remembered between
successive indented paragraphs,
and is reset to default value upon reaching a non-indented paragraph.
Default units for indents
.I i
are ens.
.PP
Type font and size are reset to default values
before each paragraph, and after processing
font and size setting macros.
.PP
These strings are predefined by
.BR \-man :
.IP \e*R
.if t `\*R', `(Reg)' in
.if t .I nroff.
.if n `(Reg)', trademark symbol in
.if n .I troff.
.IP \e*S
Change to default type size.
.SH FILES
/usr/share/tmac/tmac.an
.br
/usr/man/man.template
.SH SEE ALSO
man(1), troff(1)
.SH BUGS
Relative indents don't nest.
.SH REQUESTS
.ta \w'.TH n c x v m'u +\w'Cause 'u +\w'Argument\ 'u
.di xx
			\ka
.br
.di
.in \nau
.ti 0
Request	Cause	If no	Explanation
.ti 0
	Break	Argument
.ti 0
.tr ~.
~B \fIt\fR	no	\fIt\fR=n.t.l.*	Text
.I t
is bold.
.ti 0
~BI \fIt\fR	no	\fIt\fR=n.t.l.	Join
words of
.I t
alternating bold and italic.
.ti 0
~BR \fIt\fR	no	\fIt\fR=n.t.l.	Join
words of
.I t
alternating bold and Roman.
.ti 0
~DT	no	.5i 1i...	Restore default tabs.
.ti 0
~HP \fIi\fR	yes	\fIi\fR=p.i.*	Set prevailing indent to
.I i.
Begin paragraph with hanging indent.
.ti 0
~I \fIt\fR	no	\fIt\fR=n.t.l.	Text
.I t
is italic.
.ti 0
~IB \fIt\fR	no	\fIt\fR=n.t.l.	Join
words of
.I t
alternating italic and bold.
.ti 0
~IP \fIx i\fR	yes	\fIx\fR=""	Same as .TP with tag
.I x.
.ti 0
~IR \fIt\fR	no	\fIt\fR=n.t.l.	Join
words of
.I t
alternating italic and Roman.
.ti 0
~LP	yes	-	Same as .PP.
.ti 0
~PD \fId\fR	no	\fId\fR=.4v	Interparagraph distance is 
.I d.
.ti 0
~PP	yes	-	Begin paragraph.
Set prevailing indent to .5i.
.ti 0
~RE	yes	-	End of relative indent.
Set prevailing indent to amount of starting .RS.
.ti 0
~RB \fIt\fR	no	\fIt\fR=n.t.l.	Join
words of
.I t
alternating Roman and bold.
.ti 0
~RI \fIt\fR	no	\fIt\fR=n.t.l.	Join
words of
.I t
alternating Roman and italic.
.ti 0
~RS \fIi\fR	yes	\fIi\fR=p.i.	Start relative indent,
move left margin in distance
.I i.
Set prevailing indent to .5i for nested indents.
.ti 0
~SH \fIt\fR	yes	\fIt\fR=n.t.l.	Subhead.
.ti 0
~SM \fIt\fR	no	\fIt\fR=n.t.l.	Text
.I t
is small.
.ti 0
.ne 1i
~TH \fIn c x v m\fR	yes	-	Begin page named
.I n
of chapter
.IR c;
.I x
is extra commentary, e.g. `local', for page foot center;
.I v
alters page foot left, e.g. `4th Berkeley Distribution';
.I m
alters page head center, e.g. `Brand X Programmer's Manual'.
Set prevailing indent and tabs to .5i.
.ti 0
~TP \fIi\fR	yes	\fIi\fR=p.i.	Set prevailing indent to
.I i.
Begin indented paragraph
with hanging tag given by next text line.
If tag doesn't fit, place it on separate line.
.PP
.ti 0
* n.t.l. = next text line; p.i. = prevailing indent
cut here ---------------------------------------------------------------