mdoc.samples - tutorial sampler for writing

x manuals with -mdoc


man mdoc.samples


A tutorial sampler for writing

x manual pages with the -mdoc macro package, a .Em content Ns -based and .Em domain Ns -based formatting package for troff(1) . Its predecessor, the -man(7) package, addressed page layout leaving the manipulation of fonts and other typesetting details to the individual author. In -mdoc , page layout macros make up the .Em "page structure domain" which consists of macros for titles, section headers, displays and lists. Essentially items which affect the physical position of text on a formatted page. In addition to the page structure domain, there are two more domains, the manual domain and the general text domain. The general text domain is defined as macros which perform tasks such as quoting or emphasizing pieces of text. The manual domain is defined as macros that are a subset of the day to day informal language used to describe commands, routines and related

x files. Macros in the manual domain handle command names, command-line arguments and options, function names, function parameters, pathnames, variables, cross references to other manual pages, and so on. These domain items have value for both the author and the future user of the manual page. It is hoped the consistency gained across the manual set will provide easier translation to future documentation tools.

Throughout the .Ux manual pages, a manual entry is simply referred to as a man page, regardless of actual length and without sexist intention.


Since a tutorial document is normally read when a person desires to use the material immediately, the assumption has been made that the user of this document may be impatient. The material presented in the remained of this document is outlined as follows:

-enum -offset indent

-tag -width flag -compact -offset indent
"Macro Usage" .
"Passing Space Characters in an gument" .
"Trailing Blank Space Characters (a warning)" .
"Escaping Special Characters" .

-tag -width flag -compact -offset indent
"A manual page template" .

-tag -width flag -compact -offset indent
"What's in a name..." .
"General Syntax" .

-tag -width flag -compact -offset indent
"Addresses" .
"Author name" .
"guments" .
"Configuration Declarations (section four only)" .
"Command Modifier" .
"Defined Variables" .
"Errno's (Section two only)" .
"Environment Variables" .
"Function gument" .
"Function Declaration" .
"-ags" .
"Functions (library routines)" .
"Function Types" .
"Interactive Commands" .
"Names" .
"Options" .
"Pathnames" .
"Variables" .
"Cross References" .

-tag -width flag -compact -offset indent
"AT&T Macro" .
"BSD Macro" .
"FreeBSD Macro" .
"UNIX Macro" .
"Enclosure/Quoting Macros"

-tag -width flag -compact -offset indent
"Angle Bracket Quote/Enclosure" .
"Bracket Quotes/Enclosure" .
"Double Quote macro/Enclosure" .
"Parenthesis Quote/Enclosure" .
"Single Quotes/Enclosure" .
"Prefix Macro" .
"No-Op or Normal Text Macro" .
"No Space Macro" .
"Section Cross References" .
"References and Citations" .
"Return Values (sections two and three only)"
"Trade Names (Acronyms and Type Names)" .
"Extended guments" .

-tag -width flag -compact -offset indent
"Section Headers" .
"Paragraphs and Line Spacing" .
"Keeps" .
"Displays" .
"Font Modes (Emphasis, Literal, and Symbolic)" .
"Lists and Columns" .
.Tn "BUGS"


The -mdoc package attempts to simplify the process of writing a man page. Theoretically, one should not have to learn the dirty details of troff(1) to use -mdoc ; however, there are a few limitations which are unavoidable and best gotten out of the way. And, too, be forewarned, this package is .Em not fast. .Ss Macro Usage As in troff(1) , a macro is called by placing a .Ql . (dot character) at the beginning of a line followed by the two character name for the macro. Arguments may follow the macro separated by spaces. It is the dot character at the beginning of the line which causes troff(1) to interpret the next two characters as a macro name. To place a .Ql . (dot character) at the beginning of a line in some context other than a macro invocation, precede the .Ql . (dot) with the .Ql \& escape sequence. The .Ql \& translates literally to a zero width space, and is never displayed in the output.

In general, troff(1) macros accept up to nine arguments, any extra arguments are ignored. Most macros in -mdoc accept nine arguments and, in limited cases, arguments may be continued or extended on the next line (See .Sx Extensions ) . A few macros handle quoted arguments (see .Sx Passing Space Characters in an Argument below).

Most of the -mdoc general text domain and manual domain macros are special in that their argument lists are .Em parsed for callable macro names. This means an argument on the argument list which matches a general text or manual domain macro name and is determined to be callable will be executed or called when it is processed. In this case the argument, although the name of a macro, is not preceded by a .Ql . (dot). It is in this manner that many macros are nested; for example the option macro, .Ql .Op , may .Em call the flag and argument macros, .Ql Fl and .Ql Ar , to specify an optional flag with an argument:

-tag -width
Op -s bytes is produced by .Li .Op Fl s Ar bytes

To prevent a two character string from being interpreted as a macro name, precede the string with the escape sequence .Ql \& :

-tag -width
Op -s bytes is produced by .Li .Op \&Fl s \&Ar bytes

Here the strings .Ql Fl and .Ql Ar are not interpreted as macros. Macros whose argument lists are parsed for callable arguments are referred to as parsed and macros which may be called from an argument list are referred to as callable throughout this document and in the companion quick reference manual mdoc(7) . This is a technical .Em faux pas as almost all of the macros in -mdoc are parsed, but as it was cumbersome to constantly refer to macros as being callable and being able to call other macros, the term parsed has been used. .Ss Passing Space Characters in an Argument Sometimes it is desirable to give as one argument a string containing one or more blank space characters. This may be necessary to defeat the nine argument limit or to specify arguments to macros which expect particular arrangement of items in the argument list. For example, the function macro .Ql .Fn expects the first argument to be the name of a function and any remaining arguments to be function parameters. As .Tn "ANSI C" stipulates the declaration of function parameters in the parenthesized parameter list, each parameter is guaranteed to be at minimum a two word string. For example, .Fa int foo .

There are two possible ways to pass an argument which contains an embedded space. .Em Implementation note : Unfortunately, the most convenient way of passing spaces in between quotes by reassigning individual arguments before parsing was fairly expensive speed wise and space wise to implement in all the macros for .Tn AT&T troff . It is not expensive for groff but for the sake of portability, has been limited to the following macros which need it the most:

-tag -width 4n -offset indent -compact
Li Cd Configuration declaration (section 4 .Sx SYNOPSIS )
Li Bl Begin list (for the width specifier).
Li Em Emphasized text.
Li Fn Functions (sections two and four).
Li It List items.
Li Li Literal text.
Li Sy Symbolic text.
Li %B Book titles.
Li %J Journal names.
Li %O Optional notes for a reference.
Li %R Report title (in a reference).
Li %T Title of article in a book or journal.

One way of passing a string containing blank spaces is to use the hard or unpaddable space character .Ql \  , that is, a blank space preceded by the escape character .Ql \ . This method may be used with any macro but has the side effect of interfering with the adjustment of text over the length of a line. Troff sees the hard space as if it were any other printable character and cannot split the string into blank or newline separated pieces as one would expect. The method is useful for strings which are not expected to overlap a line boundary. For example:

-tag -width
Fn fetch char *str is created by .Ql .Fn fetch char\ *str
Fn fetch "char *str" can also be created by .Ql .Fn fetch "\\*qchar *str\\*q"

If the .Ql \ or quotes were omitted, .Ql .Fn would see three arguments and the result would be:

.Dl Fn fetch char *str

For an example of what happens when the parameter list overlaps a newline boundary, see the .Sx BUGS section. .Ss Trailing Blank Space Characters Troff can be confused by blank space characters at the end of a line. It is a wise preventive measure to globally remove all blank spaces from <blank-space><end-of-line> character sequences. Should the need arise to force a blank character at the end of a line, it may be forced with an unpaddable space and the .Ql \& escape character. For example, .Ql string\ \& . .Ss Escaping Special Characters Special characters like the newline character .Ql \n , are handled by replacing the .Ql \ with .Ql \e (e.g., .Ql \en ) to preserve the backslash.


The body of a man page is easily constructed from a basic template found in the file .Pa /usr/share/misc/mdoc.template . Several example man pages can also be found in .Pa /usr/share/examples/mdoc .

.Ss A manual page template

d -literal -offset indent .Dd Month day, year .Os OPERATING_SYSTEM [version/release]


name - one line description of name



The first items in the template are the macros .Pq Li .Dd , .Os , .Dt ; the document date, the operating system the man page or subject source is developed or modified for, and the man page title .Pq Em in upper case along with the section of the manual the page belongs in. These macros identify the page, and are discussed below in .Sx TITLE MACROS .

The remaining items in the template are section headers .Pq Li .Sh ; of which .Sx NAME , .Sx SYNOPSIS and .Sx DESCRIPTION are mandatory. The headers are discussed in .Sx PAGE STRUCTURE DOMAIN , after presentation of .Sx MANUAL DOMAIN . Several content macros are used to demonstrate page layout macros; reading about content macros before page layout macros is recommended.


The title macros are the first portion of the page structure domain, but are presented first and separate for someone who wishes to start writing a man page yesterday. Three header macros designate the document title or manual page title, the operating system, and the date of authorship. These macros are one called once at the very beginning of the document and are used to construct the headers and footers only.

-tag -width 6n
Li .Dt DOCUMENT_TITLE section# [volume] The document title is the subject of the man page and must be in .Tn CAPITALS due to troff limitations. The section number may be 1, ..., 8, and if it is specified, the volume title may be omitted. A volume title may be arbitrary or one of the following:

-column SMM -offset indent -compact
Li "AMD UNIX Ancestral Manual Documents"
Li "SMM UNIX System Manager's Manual"
Li "URM UNIX Reference Manual"
Li "PRM UNIX Programmer's Manual"

The default volume labeling is .Li URM for sections 1, 6, and 7; .Li SMM for section 8; .Li PRM for sections 2, 3, 4, and 5.
Li .Os operating_system release# The name of the operating system should be the common acronym, for example, .Tn BSD or .Tn FreeBSD or .Tn ATT . The release should be the standard release nomenclature for the system specified, for example, 4.3, 4.3+Tahoe, V.3, V.4. Unrecognized arguments are displayed as given in the page footer. For instance, a typical footer might be:

.Dl .Os 4.3BSD

or .Dl .Os FreeBSD 2.2

or for a locally produced set

.Dl .Os CS Department

The Berkeley default, .Ql .Os without an argument, has been defined as .Tn BSD in the site-specific file .Pa /usr/share/tmac/mdoc/doc-common . It really should default to .Tn LOCAL . Note, if the .Ql .Os macro is not present, the bottom left corner of the page will be ugly.
Li .Dd month day, year The date should be written formally:

.Dl January 25, 1989


.Ss What's in a name... The manual domain macro names are derived from the day to day informal language used to describe commands, subroutines and related files. Slightly different variations of this language are used to describe the three different aspects of writing a man page. First, there is the description of -mdoc macro request usage. Second is the description of a .Ux command .Em with -mdoc macros and third, the description of a command to a user in the verbal sense; that is, discussion of a command in the text of a man page.

In the first case, troff(1) macros are themselves a type of command; the general syntax for a troff command is:

d -filled -offset indent .Va argument1 argument2 ... argument9

The .Ql .Va is a macro command or request, and anything following it is an argument to be processed. In the second case, the description of a .Ux command using the content macros is a bit more involved; a typical .Sx SYNOPSIS command line might be displayed as:

d -filled -offset indent filter [-flag] infile outfile

Here, filter is the command name and the bracketed string - flag is a .Em flag argument designated as optional by the option brackets. In -mdoc terms, infile and outfile are called .Em arguments . The macros which formatted the above example:

d -literal -offset indent filter [-flag] infile outfile

In the third case, discussion of commands and command syntax includes both examples above, but may add more detail. The arguments infile and outfile from the example above might be referred to as .Em operands or .Em file arguments . Some command-line argument lists are quite long:

-tag -width make -offset indent
Nm make [-eiknqrstv] [-D variable ] [-d flags ] [-f makefile ]

k -words [-I directory ] .Ek [-j max_jobs ] .Op Ar variable=value

k -words [target] ... .Ek

Here one might talk about the command make and qualify the argument makefile , as an argument to the flag, - f , or discuss the optional file operand target . In the verbal context, such detail can prevent confusion, however the -mdoc package does not have a macro for an argument .Em to a flag. Instead the .Ql Ar argument macro is used for an operand or file argument like target as well as an argument to a flag like variable . The make command line was produced from:

d -literal -offset indent make [-eiknqrstv] [-D variable ] [-d flags ] [-f makefile ] [-I directory ] [-j max_jobs ] .Op Ar variable=value

k -words [target] ... .Ek

The .Ql .Bk and .Ql .Ek macros are explained in .Sx Keeps . .Ss General Syntax The manual domain and general text domain macros share a similar syntax with a few minor deviations: .Ql .Ar , .Ql .Fl , .Ql .Nm , and .Ql .Pa differ only when called without arguments; .Ql .Fn and .Ql .Xr impose an order on their argument lists and the .Ql .Op and .Ql .Fn macros have nesting limitations. All content macros are capable of recognizing and properly handling punctuation, provided each punctuation character is separated by a leading space. If a request is given:

.Dl .Li sptr, ptr),

The result is:

.Dl Li sptr, ptr),

The punctuation is not recognized and all is output in the literal font. If the punctuation is separated by a leading white space:

.Dl .Li "sptr , ptr ) ,"

The result is:

.Dl Li sptr , ptr ) ,

The punctuation is now recognized and is output in the default font distinguishing it from the strings in literal font.

To remove the special meaning from a punctuation character escape it with .Ql \& . Troff is limited as a macro language, and has difficulty when presented with a string containing a member of the mathematical, logical or quotation set:

d -literal -offset indent-two {+,-,/,*,%,<,>,<=,>=,=,==,&,`,',"}

The problem is that troff may assume it is supposed to actually perform the operation or evaluation suggested by the characters. To prevent the accidental evaluation of these characters, escape them with .Ql \& . Typical syntax is shown in the first content macro displayed below, .Ql .Ad .


.Ss Address Macro The address macro identifies an address construct of the form addr1[,addr2[,addr3]].

.Dl Usage: .Ad address ... \*(Pu

-tag -width
Li .Ad addr1
Li .Ad addr1 .
Li .Ad addr1 , file2
Li .Ad f1 , f2 , f3 :
Li .Ad addr ) ) ,

It is an error to call .Ql .Ad without arguments. .Ql .Ad is callable by other macros and is parsed. .Ss Author Name The .Ql .An macro is used to specify the name of the author of the item being documented, or the name of the author of the actual manual page. Any remaining arguments after the name information are assumed to be punctuation.

.Dl Usage: .An author_name \*(Pu

-tag -width
Li .An Joe Author .An Joe Author
Li .An Joe Author , .An Joe Author ,
Li .An Joe Author Aq  .An Joe Author Aq
Li .An Joe Author ) ) , .An Joe Author ) ) ,

The .Ql .An macro is parsed and is callable. It is an error to call .Ql .An without any arguments. .Ss Argument Macro The .Ql .Ar argument macro may be used whenever a command-line argument is referenced.

.Dl Usage: .Ar argument ... \*(Pu

-tag -width
Li .
Li . file1 file1
Li . file1 . file1 .
Li . file1 file2 file1 file2
Li . f1 f2 f3 : f1 f2 f3 :
Li . file ) ) , file ) ) ,

If .Ql .Ar is called without arguments .Ql Ar is assumed. The .Ql .Ar macro is parsed and is callable. .Ss Configuration Declaration (section four only) The .Ql .Cd macro is used to demonstrate a config(8) declaration for a device interface in a section four manual. This macro accepts quoted arguments (double quotes only).

-tag -width
Cd "device le0 at scode?" produced by: .Ql ".Cd device le0 at scode?" . .Ss Command Modifier The command modifier is identical to the .Ql .Fl (flag) command with the exception the .Ql .Cm macro does not assert a dash in front of every argument. Traditionally flags are marked by the preceding dash, some commands or subsets of commands do not use them. Command modifiers may also be specified in conjunction with interactive commands such as editor commands. See .Sx Flags . .Ss Defined Variables A variable which is defined in an include file is specified by the macro .Ql .Dv .

.Dl Usage: .Dv defined_variable ... \*(Pu

-tag -width

It is an error to call .Ql .Dv without arguments. .Ql .Dv is parsed and is callable. .Ss Errno's (Section two only) The .Ql .Er errno macro specifies the error return value for section two library routines. The second example below shows .Ql .Er used with the .Ql .Bq general text domain macro, as it would be used in a section two manual page.

.Dl Usage: .Er ERRNOTYPE ... \*(Pu

-tag -width
Li .Er ENOENT ) ; .Er ENOENT ) ;


It is an error to call .Ql .Er without arguments. The .Ql .Er macro is parsed and is callable. .Ss Environment Variables The .Ql .Ev macro specifies an environment variable.

.Dl Usage: .Ev argument ... \*(Pu

-tag -width
Li .Ev PATH . PATH .
Li .Ev PRINTER ) ) , PRINTER ) ) ,

It is an error to call .Ql .Ev without arguments. The .Ql .Ev macro is parsed and is callable. .Ss Function Argument The .Ql .Fa macro is used to refer to function arguments (parameters) outside of the .Sx SYNOPSIS section of the manual or inside the .Sx SYNOPSIS section should a parameter list be too long for the .Ql .Fn macro and the enclosure macros .Ql .Fo and .Ql .Fc must be used. .Ql .Fa may also be used to refer to structure members.

.Dl Usage: .Fa function_argument ... \*(Pu

-tag -width
Li .Fa d_namlen ) ) , .Fa d_namlen ) ) ,
Li .Fa iov_len .Fa iov_len

It is an error to call .Ql .Fa without arguments. .Ql .Fa is parsed and is callable. .Ss Function Declaration The .Ql .Fd macro is used in the .Sx SYNOPSIS section with section two or three functions. The .Ql .Fd macro does not call other macros and is not callable by other macros.

.Dl Usage: .Fd include_file (or defined variable)

In the .Sx SYNOPSIS section a .Ql .Fd request causes a line break if a function has already been presented and a break has not occurred. This leaves a nice vertical space in between the previous function call and the declaration for the next function. .Ss Flags The .Ql .Fl macro handles command-line flags. It prepends a dash, .Ql - , to the flag. For interactive command flags, which are not prepended with a dash, the .Ql .Cm (command modifier) macro is identical, but without the dash.

.Dl Usage: .Fl argument ... \*(Pu

-tag -width
Li .--
Li .-cfv - cfv
Li .-cfv . - cfv .
Li .-s v t - s v t
Li .-- , - - ,
Li .-xyz ) , - xyz ) ,

The .Ql .Fl macro without any arguments results in a dash representing stdin/stdout. Note that giving .Ql .Fl a single dash, will result in two dashes. The .Ql .Fl macro is parsed and is callable. .Ss Functions (library routines) The .Fn macro is modeled on ANSI C conventions.

d -literal Usage: .Fn [type] function [[type] parameters ... \*(Pu]

-tag -width
Li ".Fn getchar" .Fn getchar
Li ".Fn strlen ) ," .Fn strlen ) ,
Li .Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" , .Fn "int align" "const * char *sptrs" ,

It is an error to call .Ql .Fn without any arguments. The .Ql .Fn macro is parsed and is callable, note that any call to another macro signals the end of the .Ql .Fn call (it will close-parenthesis at that point).

For functions that have more than eight parameters (and this is rare), the macros .Ql .Fo (function open) and .Ql .Fc (function close) may be used with .Ql .Fa (function argument) to get around the limitation. For example:

d -literal -offset indent .Fo "int res_mkquery" .Fa "int op" .Fa "char *dname" .Fa "int class" .Fa "int type" .Fa "char *data" .Fa "int datalen" .Fa "struct rrec *newrr" .Fa "char *buf" .Fa "int buflen" .Fc


d -filled -offset indent .Fo "int res_mkquery" .Fa "int op" .Fa "char *dname" .Fa "int class" .Fa "int type" .Fa "char *data" .Fa "int datalen" .Fa "struct rrec *newrr" .Fa "char *buf" .Fa "int buflen" .Fc

The .Ql .Fo and .Ql .Fc macros are parsed and are callable. In the .Sx SYNOPSIS section, the function will always begin at the beginning of line. If there is more than one function presented in the .Sx SYNOPSIS section and a function type has not been given, a line break will occur, leaving a nice vertical space between the current function name and the one prior. At the moment, .Ql .Fn does not check its word boundaries against troff line lengths and may split across a newline ungracefully. This will be fixed in the near future. .Ss Function Type This macro is intended for the .Sx SYNOPSIS section. It may be used anywhere else in the man page without problems, but its main purpose is to present the function type in kernel normal form for the .Sx SYNOPSIS of sections two and three (it causes a line break allowing the function name to appear on the next line).

.Dl Usage: .Ft type ... \*(Pu

-tag -width
Li .Ft struct stat

The .Ql .Ft request is not callable by other macros. .Ss Interactive Commands The .Ql .Ic macro designates an interactive or internal command.

.Dl Usage: .Ic argument ... \*(Pu

-tag -width
Li .Ic :wq :wq
Li .Ic do while {...} do while {...}
Li .Ic setenv , unsetenv setenv , unsetenv

It is an error to call .Ql .Ic without arguments. The .Ql .Ic macro is parsed and is callable. .Ss Name Macro The .Ql .Nm macro is used for the document title or subject name. It has the peculiarity of remembering the first argument it was called with, which should always be the subject name of the page. When called without arguments, .Ql .Nm regurgitates this initial name for the sole purpose of making less work for the author. Note: a section two or three document function name is addressed with the .Ql .Nm in the .Sx NAME section, and with .Ql .Fn in the .Sx SYNOPSIS and remaining sections. For interactive commands, such as the .Ql while command keyword in csh(1) , the .Ql .Ic macro should be used. While the .Ql .Ic is nearly identical to .Ql .Nm , it can not recall the first argument it was invoked with.

.Dl Usage: .Nm argument ... \*(Pu

-tag -width
Li .Nm mdoc.sample mdoc.sample
Li .Nm \-mdoc -mdoc .
Li .Nm foo ) ) , foo ) ) ,
Li .Nm

The .Ql .Nm macro is parsed and is callable. .Ss Options The .Ql .Op macro places option brackets around the any remaining arguments on the command line, and places any trailing punctuation outside the brackets. The macros .Ql .Oc and .Ql .Oo may be used across one or more lines.

.Dl Usage: .Op options ... \*(Pu

-tag -width
Li .Op .Op
Li ".Op -k" [-k]
Li ".Op -k ) ." [-k] ) .
Li ".Op -k kookfile" [-k kookfile ]
Li ".Op -k kookfile ," [-k kookfile , ]
Li ".Op objfil Op corfil" [objfil] Op Ar corfil
Li ".Op -c objfil Op corfil ," [-c objfil Op Ar corfil , ]
Li .Op word1 word2 .Op word1 word2

The .Ql .Oc and .Ql .Oo macros:

d -literal -offset indent .Oo [-k kilobytes ] [-i interval ] [-c count ] .Oc

Produce: .Oo [-k kilobytes ] [-i interval ] [-c count ] .Oc

The macros .Ql .Op , .Ql .Oc and .Ql .Oo are parsed and are callable. .Ss Pathnames The .Ql .Pa macro formats pathnames or filenames.

.Dl Usage: .Pa pathname \*(Pu

-tag -width
Li .Pa /usr/share .Pa /usr/share
Li .Pa /tmp/fooXXXXX ) . .Pa /tmp/fooXXXXX ) .

The .Ql .Pa macro is parsed and is callable. .Ss Variables Generic variable reference:

.Dl Usage: .Va variable ... \*(Pu

-tag -width
Li .Va count .Va count
Li .Va settimer , .Va settimer ,
Li .Va int *prt ) : .Va int *prt ) :
Li .Va char s ] ) ) , .Va char s ] ) ) ,

It is an error to call .Ql .Va without any arguments. The .Ql .Va macro is parsed and is callable. .Ss Manual Page Cross References The .Ql .Xr macro expects the first argument to be a manual page name, and the second argument, if it exists, to be either a section page number or punctuation. Any remaining arguments are assumed to be punctuation.

.Dl Usage: .Xr man_page [1,...,8] \*(Pu

-tag -width
Li .Xr mdoc mdoc
Li .Xr mdoc , mdoc ,
Li .Xr mdoc 7 mdoc(7)
Li .Xr mdoc 7 ) ) , mdoc(7) ) ) ,

The .Ql .Xr macro is parsed and is callable. It is an error to call .Ql .Xr without any arguments.


.Ss AT&T Macro

d -literal -offset indent -compact Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu

-tag -width
Li ".At" .At
Li ".At v6 ." .At v6 .

The .Ql .At macro is .Em not parsed and .Em not callable It accepts at most two arguments. .Ss BSD Macro .Dl Usage: .Bx [Version/release] ... \*(Pu

-tag -width
Li ".Bx"

Li ".Bx 4.3 ."

x 4.3 .

The .Ql .Bx macro is parsed and is callable. .Ss FreeBSD Macro

d -literal -offset indent -compact Usage: .Fx Version.release ... \*(Pu

-tag -width
Li ".Fx 2.2 ." .Fx 2.2 .

The .Ql .Fx macro is .Em not parsed and .Em not callable It accepts at most two arguments. .Ss UNIX Macro .Dl Usage: .Ux ... \*(Pu

-tag -width
Li ".Ux" .Ux

The .Ql .Ux macro is parsed and is callable. .Ss Enclosure and Quoting Macros The concept of enclosure is similar to quoting. The object being to enclose one or more strings between a pair of characters like quotes or parentheses. The terms quoting and enclosure are used interchangeably throughout this document. Most of the one line enclosure macros end in small letter .Ql q to give a hint of quoting, but there are a few irregularities. For each enclosure macro there is also a pair of open and close macros which end in small letters .Ql o and .Ql c respectively. These can be used across one or more lines of text and while they have nesting limitations, the one line quote macros can be used inside of them.

d -filled -offset indent

-column .Em " Quote Close Open Function Result" .Aq .Ac .Ao Angle Bracket Enclosure <string>

q .Bc .Bo Bracket Enclosure [string] .Dq .Dc .Do Double Quote ``string'' .Ec .Eo Enclose String (in XX) XXstringXX .Pq .Pc .Po Parenthesis Enclosure (string) .Ql Quoted Literal `st' or string .Qq .Qc .Qo Straight Double Quote "string" .Sq .Sc .So Single Quote `string'

Except for the irregular macros noted below, all of the quoting macros are parsed and callable. All handle punctuation properly, as long as it is presented one character at a time and separated by spaces. The quoting macros examine opening and closing punctuation to determine whether it comes before or after the enclosing string This makes some nesting possible.

-tag -width xxx,xxxx
Li .Ec , .Eo These macros expect the first argument to be the opening and closing strings respectively.
Li .Ql The quoted literal macro behaves differently for troff than nroff . If formatted with nroff , a quoted literal is always quoted. If formatted with troff, an item is quoted only if the width of the item is less than three constant width characters. This is to make short strings more visible where the font change to literal (constant width) is less noticeable.
Li .Pf The prefix macro is not callable, but it is parsed:

-tag -width
Li ".Pf ( Fa name2" becomes .Pf ( Fa name2 .

The .Ql .Ns (no space) macro performs the analogous suffix function.

Examples of quoting:

-tag -width
Li .Aq .Aq
Li .Aq ctype.h ) , .Aq Ar ctype.h ) ,
Li .Bq

Li .Bq Em Greek , French .

q Em Greek , French .
Li .Dq .Dq
Li ".Dq string abc ." .Dq string abc .
Li ".Dq \'^[A-Z]\'" .Dq \'^[A-Z]\'
Li ".Ql man mdoc" .Ql man mdoc
Li .Qq .Qq
Li ".Qq string ) ," .Qq string ) ,
Li ".Qq string Ns )," .Qq string Ns ),
Li .Sq .Sq
Li ".Sq string .Sq string

For a good example of nested enclosure macros, see the .Ql .Op option macro. It was created from the same underlying enclosure macros as those presented in the list above. The .Ql .Xo and .Ql .Xc extended argument list macros were also built from the same underlying routines and are a good example of -mdoc macro usage at its worst. .Ss No-Op or Normal Text Macro The macro .Ql .No is a hack for words in a macro command line which should .Em not be formatted and follows the conventional syntax for content macros. .Ss No Space Macro The .Ql .Ns macro eliminates unwanted spaces in between macro requests. It is useful for old style argument lists where there is no space between the flag and argument:

-tag -width
Li ".Op -I Ns directory" produces [-I] Ns Ar directory

Note: the .Ql .Ns macro always invokes the .Ql .No macro after eliminating the space unless another macro name follows it. The macro .Ql .Ns is parsed and is callable. .Ss Section Cross References The .Ql .Sx macro designates a reference to a section header within the same document. It is parsed and is callable.

-tag -width
Li .Sx FILES .Sx FILES .Ss References and Citations The following macros make a modest attempt to handle references. At best, the macros make it convenient to manually drop in a subset of refer style references.

-tag -width 6n -offset indent -compact
Li ".Rs" Reference Start. Causes a line break and begins collection of reference information until the reference end macro is read.
Li ".Re" Reference End. The reference is printed.
Li ".%A" Reference author name, one name per invocation.
Li ".%B" Book title.
Li ".%C" City/place.
Li ".%D" Date.
Li ".%J" Journal name.
Li ".%N" Issue number.
Li ".%O" Optional information.
Li ".%P" Page number.
Li ".%R" Report name.
Li ".%T" Title of article.
Li ".%V" Volume(s).

The macros beginning with .Ql % are not callable, and are parsed only for the trade name macro which returns to its caller. (And not very predictably at the moment either.) The purpose is to allow trade names to be pretty printed in troff Ns / Ns Xr ditroff output. .Ss Return Values The .Ql .Rv macro generates text for use in the .Sx RETURN VALUE section.

.Dl Usage: .Rv [-std function]

.Ql .Rv -std atexit will generate the following text:

.Rv -std atexit

The - std option is valid only for manual page sections 2 and 3. .Ss Trade Names (or Acronyms and Type Names) The trade name macro is generally a small caps macro for all upper case words longer than two characters.

.Dl Usage: .Tn symbol ... \*(Pu

-tag -width
Li .Tn DEC .Tn DEC

The .Ql .Tn macro is parsed and is callable by other macros. .Ss Extended Arguments The .Ql .Xo and .Ql .Xc macros allow one to extend an argument list on a macro boundary. Argument lists cannot be extended within a macro which expects all of its arguments on one line such as .Ql .Op .

Here is an example of .Ql .Xo using the space mode macro to turn spacing off:

d -literal -offset indent .Sm off
Sy I operation \en Ar count No \en .Xc .Sm on


d -filled -offset indent

-tag -width flag -compact .Sm off
Sy I operation \n Ar count No \n .Xc .Sm on

Another one:

d -literal -offset indent .Sm off
Cm S No / old_pattern / Ar new_pattern / Op Cm g .Xc .Sm on


d -filled -offset indent

-tag -width flag -compact .Sm off
Cm S No / old_pattern / Ar new_pattern / Op Cm g .Xc .Sm on

Another example of .Ql .Xo and using enclosure macros: Test the value of a variable.

d -literal -offset indent
.Oo \&! Oc Ns Ar variable [operator] variable ... .Xc


d -filled -offset indent

-tag -width flag -compact
.Oo ! Oc Ns Ar variable [operator] variable ... .Xc

All of the above examples have used the .Ql .Xo macro on the argument list of the .Ql .It (list-item) macro. The extend macros are not used very often, and when they are it is usually to extend the list-item argument list. Unfortunately, this is also where the extend macros are the most finicky. In the first two examples, spacing was turned off; in the third, spacing was desired in part of the output but not all of it. To make these macros work in this situation make sure the .Ql .Xo and .Ql .Xc macros are placed as shown in the third example. If the .Ql .Xo macro is not alone on the .Ql .It argument list, spacing will be unpredictable. The .Ql .Ns (no space macro) must not occur as the first or last macro on a line in this situation. Out of 900 manual pages (about 1500 actual pages) currently released with

x only fifteen use the .Ql .Xo macro.


.Ss Section Headers The first three .Ql .Sh section header macros list below are required in every man page. The remaining section headers are recommended at the discretion of the author writing the manual page. The .Ql .Sh macro can take up to nine arguments. It is parsed and but is not callable.

-tag -width
.Sh NAME The .Ql .Sh NAME macro is mandatory. If not specified, the headers, footers and page layout defaults will not be set and things will be rather unpleasant. The .Sx NAME section consists of at least three items. The first is the .Ql .Nm name macro naming the subject of the man page. The second is the Name Description macro, .Ql - , which separates the subject name from the third item, which is the description. The description should be the most terse and lucid possible, as the space available is small.
.Sh SYNOPSIS The .Sx SYNOPSIS section describes the typical usage of the subject of a man page. The macros required are either .Ql ".Nm" , .Ql ".Cd" , .Ql ".Fn" , (and possibly .Ql ".Fo" , .Ql ".Fc" , .Ql ".Fd" , .Ql ".Ft" macros). The function name macro .Ql ".Fn" is required for manual page sections 2 and 3, the command and general name macro .Ql .Nm is required for sections 1, 5, 6, 7, 8. Section 4 manuals require a .Ql ".Nm" , .Ql ".Fd" or a .Ql ".Cd" configuration device usage macro. Several other macros may be necessary to produce the synopsis line as shown below:

d -filled -offset indent cat [-benstuv] .Op Fl

The following macros were used:

.Dl .Nm cat .Dl .Op Fl benstuv .Dl .Op Fl .Dl .Ar

.Sy Note : The macros .Ql .Op , .Ql .Fl , and .Ql .Ar recognize the pipe bar character .Ql \*(Ba , so a command line such as:

.Dl ".Op Fl a | Fl b"

will not go orbital. Troff normally interprets a \*(Ba as a special operator. See .Sx PREDEFINED STRINGS for a usable \*(Ba character in other situations.

.Sh DESCRIPTION In most cases the first text in the .Sx DESCRIPTION section is a brief paragraph on the command, function or file, followed by a lexical list of options and respective explanations. To create such a list, the .Ql .Bl begin-list, .Ql .It list-item and .Ql .El end-list macros are used (see .Sx Lists and Columns below).

The following .Ql .Sh section headers are part of the preferred manual page layout and must be used appropriately to maintain consistency. They are listed in the order in which they would be used.

-tag -width SYNOPSIS
.Sh ENVIRONMENT The .Sx ENVIRONMENT section should reveal any related environment variables and clues to their behavior and/or usage.
.Sh EXAMPLES There are several ways to create examples. See the .Sx EXAMPLES section below for details.
.Sh FILES Files which are used or created by the man page subject should be listed via the .Ql .Pa macro in the .Sx FILES section.
.Sh SEE ALSO References to other material on the man page topic and cross references to other relevant man pages should be placed in the .Sx SEE ALSO section. Cross references are specified using the .Ql .Xr macro. Cross references in the .Sx SEE ALSO section should be sorted by section number, and then placed in alphabetical order and comma separated. For example:

ls(1) , ps(1) , group(5) , passwd(5) .

At this time refer(1) style references are not accommodated.
.Sh CONFORMING TO If the command, library function or file adheres to a specific implementation such as IEEE Std 1003.2 ("POSIX.2") or .St -ansiC this should be noted here. If the command does not adhere to any standard, its history should be noted in the .Sx HISTORY section.
.Sh HISTORY Any command which does not adhere to any specific standards should be outlined historically in this section.
.Sh AUTHORS Credits, if need be, should be placed here.
.Sh DIAGNOSTICS Diagnostics from a command should be placed in this section.
.Sh ERRORS Specific error handling, especially from library functions (man page sections 2 and 3) should go here. The .Ql .Er macro is used to specify an errno.
.Sh BUGS Blatant problems with the topic go here...

User specified .Ql .Sh sections may be added, for example, this section was set with:

d -literal -offset 14n


.Ss Paragraphs and Line Spacing.

-tag -width 6n
.Pp The .Ql .Pp paragraph command may be used to specify a line space where necessary. The macro is not necessary after a .Ql .Sh or .Ql .Ss macro or before a .Ql .Bl macro. (The .Ql .Bl macro asserts a vertical distance unless the -compact flag is given). .Ss Keeps The only keep that is implemented at this time is for words. The macros are .Ql .Bk (begin-keep) and .Ql .Ek (end-keep). The only option that .Ql .Bk accepts is - words and is useful for preventing line breaks in the middle of options. In the example for the make command-line arguments (see .Sx What's in a name ) , the keep prevented nroff from placing up the flag and the argument on separate lines. (Actually, the option macro used to prevent this from occurring, but was dropped when the decision (religious) was made to force right justified margins in troff as options in general look atrocious when spread across a sparse line. More work needs to be done with the keep macros, a - line option needs to be added.) .Ss Examples and Displays There are five types of displays, a quickie one line indented display .Ql .D1 , a quickie one line literal display .Ql .Dl , and a block literal, block filled and block ragged which use the .Ql .Bd begin-display and .Ql .Ed end-display macros.

-tag -width .Dlxx
Li .D1 (D-one) Display one line of indented text. This macro is parsed, but it is not callable.

.Dl Fl ldghfstru

The above was produced by: .Li .Dl Fl ldghfstru .
Li .Dl (D-ell) Display one line of indented .Em literal text. The .Ql .Dl example macro has been used throughout this file. It allows the indent (display) of one line of text. Its default font is set to constant width (literal) however it is parsed and will recognized other macros. It is not callable however.

.Dl % ls -ldg /usr/local/bin

The above was produced by .Li .Dl % ls -ldg /usr/local/bin .
Li .Bd Begin-display. The .Ql .Bd display must be ended with the .Ql .Ed macro. Displays may be nested within displays and lists. .Ql .Bd has the following syntax:

.Dl ".Bd display-type [-offset offset_value] [-compact]"

The display-type must be one of the following four types and may have an offset specifier for indentation: .Ql .Bd .

-tag -width
-ragged Display a block of text as typed, right (and left) margin edges are left ragged.
-filled Display a filled (formatted) block. The block of text is formatted (the edges are filled - not left unjustified).
-literal Display a literal block, useful for source code or simple tabbed or spaced text.
-file file_name The filename following the - file flag is read and displayed. Literal mode is asserted and tabs are set at 8 constant width character intervals, however any troff/ Ns Nm -mdoc commands in file will be processed.
-offset string If - offset is specified with one of the following strings, the string is interpreted to indicate the level of indentation for the forthcoming block of text:

-tag -width
left Align block on the current left margin, this is the default mode of .Ql .Bd .
center Supposedly center the block. At this time unfortunately, the block merely gets left aligned about an imaginary center margin.
indent Indents by one default indent value or tab. The default indent value is also used for the .Ql .D1 display so one is guaranteed the two types of displays will line up. This indent is normally set to 6n or about two thirds of an inch (six constant width characters).
indent-two Indents two times the default indent value.
right This .Em left aligns the block about two inches from the right side of the page. This macro needs work and perhaps may never do the right thing by troff .
".Ed" End-display. .Ss Font Modes There are five macros for changing the appearance of the manual page text:

-tag -width .Emxx
.Em Text may be stressed or emphasized with the .Ql .Em macro. The usual font for emphasis is italic.

.Dl Usage: .Em argument ... \*(Pu

-tag -width
Li ".Em does not" .Em does not
Li ".Em exceed 1024 ." .Em exceed 1024 .
Li ".Em vide infra ) ) ," .Em vide infra ) ) ,

The .Ql .Em macro is parsed and is callable. It is an error to call .Ql .Em without arguments.
.Li The .Ql .Li literal macro may be used for special characters, variable constants, anything which should be displayed as it would be typed.

.Dl Usage: .Li argument ... \*(Pu

-tag -width
Li .Li \en .Li \n
Li .Li M1 M2 M3 ; .Li M1 M2 M3 ;
Li .Li cntrl-D ) , .Li cntrl-D ) ,
Li .Li 1024 ... .Li 1024 ...

The .Ql .Li macro is parsed and is callable.
.Sy The symbolic emphasis macro is generally a boldface macro in either the symbolic sense or the traditional English usage.

.Dl Usage: .Sy symbol ... \*(Pu

-tag -width
Li .Sy Important Notice .Sy Important Notice

The .Ql .Sy macro is parsed and is callable. Arguments to .Ql .Sy may be quoted.
Li .Bf Begin font mode. The .Ql .Bf font mode must be ended with the .Ql .Ef macro. Font modes may be nested within other font modes. .Ql .Bf has the following syntax:

.Dl ".Bf font-mode"

The font-mode must be one of the following three types: .Ql .Bf .

-tag -width
Sy Em | -emphasis Same as if the .Ql .Em macro was used for the entire block of text.
Sy Li | -literal Same as if the .Ql .Li macro was used for the entire block of text.
Sy Sy | -symbolic Same as if the .Ql .Sy macro was used for the entire block of text.
".Ef" End font mode. .Ss Tagged Lists and Columns There are several types of lists which may be initiated with the .Ql ".Bl" begin-list macro. Items within the list are specified with the .Ql ".It" item macro and each list must end with the .Ql ".El" macro. Lists may be nested within themselves and within displays. Columns may be used inside of lists, but lists are unproven inside of columns.

In addition, several list attributes may be specified such as the width of a tag, the list offset, and compactness (blank lines between items allowed or disallowed). Most of this document has been formatted with a tag style list .Pq Fl tag . For a change of pace, the list-type used to present the list-types is an over-hanging list .Pq Fl ohang . This type of list is quite popular with .Tn TeX users, but might look a bit funny after having read many pages of tagged lists. The following list types are accepted by .Ql ".Bl" :

-ohang -compact
-enum These three are the simplest types of lists. Once the .Ql ".Bl" macro has been given, items in the list are merely indicated by a line consisting solely of the .Ql ".It" macro. For example, the source text for a simple enumerated list would look like:

d -literal -offset indent-two

-enum -compact
Item one goes here.
And item two here.
Lastly item three goes here.

The results:

-enum -offset indent-two -compact
Item one goes here.
And item two here.
Lastly item three goes here.

A simple bullet list construction:

d -literal -offset indent-two

-bullet -compact
Bullet one goes here.
Bullet two here.


-bullet -offset indent-two -compact
Bullet one goes here.
Bullet two here.

-ohang -compact
-inset These list-types collect arguments specified with the .Ql .It macro and create a label which may be .Em inset into the forthcoming text, .Em hanged from the forthcoming text, .Em overhanged from above and not indented or .Em tagged . This list was constructed with the .Ql Fl ohang list-type. The .Ql .It macro is parsed only for the inset, hang and tag list-types and is not callable. Here is an example of inset labels:

-inset -offset indent
Em Tag The tagged list (also called a tagged paragraph) is the most common type of list used in the Berkeley manuals.
Em Diag Diag lists create section four diagnostic lists and are similar to inset lists except callable macros are ignored.
Em Hang Hanged labels are a matter of taste.
Em Ohang Overhanging labels are nice when space is constrained.
Em Inset Inset labels are useful for controlling blocks of paragraphs and are valuable for converting -mdoc manuals to other formats.

Here is the source text which produced the above example:

d -literal -offset indent

-inset -offset indent
Em Tag The tagged list (also called a tagged paragraph) is the most common type of list used in the Berkeley manuals.
Em Diag Diag lists create section four diagnostic lists and are similar to inset lists except callable macros are ignored.
Em Hang Hanged labels are a matter of taste.
Em Ohang Overhanging labels are nice when space is constrained.
Em Inset Inset labels are useful for controlling blocks of paragraphs and are valuable for converting -mdoc manuals to other formats.

Here is a hanged list with two items:

-hang -offset indent
Em Hanged labels appear similar to tagged lists when the label is smaller than the label width.
Em Longer hanged list labels blend in to the paragraph unlike tagged paragraph labels.

And the unformatted text which created it:

d -literal -offset indent

-hang -offset indent
Em Hanged labels appear similar to tagged lists when the label is smaller than the label width.
Em Longer hanged list labels blend in to the paragraph unlike tagged paragraph labels.

The tagged list which follows uses an optional width specifier to control the width of the tag.

-tag -width
SL sleep time of the process (seconds blocked)
PAGEIN number of disk .Tn I/O Ns 's resulting from references by the process to pages not loaded in core.
UID numerical user-id of process owner
PPID numerical ID of parent of process process priority (nonpositive when in noninterruptible wait)

The raw text:

d -literal -offset indent

-tag -width
SL sleep time of the process (seconds blocked)
PAGEIN number of disk .Tn I/O Ns 's resulting from references by the process to pages not loaded in core.
UID numerical user ID of process owner
PPID numerical ID of parent of process process priority (nonpositive when in noninterruptible wait)

Acceptable width specifiers:

-tag -width Ar -offset indent
-width "-" sets the width to the default width for a flag. All callable macros have a default width value. The .Ql .Fl , value is presently set to ten constant width characters or about five sixth of an inch.
-width "24n" sets the width to 24 constant width characters or about two inches. The .Ql n is absolutely necessary for the scaling to work correctly.
-width "ENAMETOOLONG" sets width to the constant width length of the string given.
-width "\\*qint mkfifo\\*q" again, the width is set to the constant width of the string given.

If a width is not specified for the tag list type, the first time .Ql .It is invoked, an attempt is made to determine an appropriate width. If the first argument to .Ql ".It" is a callable macro, the default width for that macro will be used as if the macro name had been supplied as the width. However, if another item in the list is given with a different callable macro name, a new and nested list is assumed.


The following strings are predefined as may be used by preceding with the troff string interpreting sequence .Ql \*(xx where .Em xx is the name of the defined string or as .Ql \*x where .Em x is the name of the string. The interpreting sequence may be used any where in the text.

Sy "String Nroff Troff"
Li "<=" Ta <= Ta \*(<=
Li ">=" Ta >= Ta \*(>=
Li "Rq" Ta "''" Ta \*(Rq
Li "Lq" Ta "``" Ta \*(Lq
Li "ua" Ta ^ Ta \*(ua
Li "aa" Ta ' Ta \*(aa
Li "ga" Ta \` Ta \*(ga
Li "q" Ta " Ta \*q
Li "Pi" Ta pi Ta \*(Pi
Li "Ne" Ta != Ta \*(Ne
Li "Le" Ta <= Ta \*(Le
Li "Ge" Ta >= Ta \*(Ge
Li "Lt" Ta < Ta \*(Gt
Li "Gt" Ta > Ta \*(Lt
Li "Pm" Ta +- Ta \*(Pm
Li "If" Ta infinity Ta \*(If
Li "Na" Ta NaN Ta \*(Na
Li "Ba" Ta \fR|\fP Ta \*(Ba

.Sy Note : The string named .Ql q should be written as .Ql \*q since it is only one char.


The debugging facilities for -mdoc are limited, but can help detect subtle errors such as the collision of an argument name with an internal register or macro name. (A what?) A register is an arithmetic storage class for troff with a one or two character name. All registers internal to -mdoc for troff and ditroff are two characters and of the form <upper_case><lower_case> such as .Ql Ar , <lower_case><upper_case> as .Ql aR or <upper or lower letter><digit> as .Ql C1 . And adding to the muddle, troff has its own internal registers all of which are either two lower case characters or a dot plus a letter or metacharacter character. In one of the introduction examples, it was shown how to prevent the interpretation of a macro name with the escape sequence .Ql \& . This is sufficient for the internal register names also.

If a nonescaped register name is given in the argument list of a request unpredictable behavior will occur. In general, any time huge portions of text do not appear where expected in the output, or small strings such as list tags disappear, chances are there is a misunderstanding about an argument type in the argument list. Your mother never intended for you to remember this evil stuff - so here is a way to find out whether or not your arguments are valid: The .Ql .Db (debug) macro displays the interpretation of the argument list for most macros. Macros such as the .Ql .Pp (paragraph) macro do not contain debugging information. All of the callable macros do, and it is strongly advised whenever in doubt, turn on the .Ql .Db macro.

.Dl Usage: .Db [on | off]

An example of a portion of text with the debug macro placed above and below an artificially created problem (a flag argument .Ql aC which should be .Ql \&aC in order to work):

d -literal -offset indent .Db on [-aC] Ar file ) .Db off

The resulting output:

d -literal -offset indent DEBUGGING ON DEBUG(argv) MACRO: `.Op' Line #: 2 Argc: 1 Argv: `Fl' Length: 2 Space: `' Class: Executable Argc: 2 Argv: `aC' Length: 2 Space: `' Class: Executable Argc: 3 Argv: `Ar' Length: 2 Space: `' Class: Executable Argc: 4 Argv: `file' Length: 4 Space: ` ' Class: String Argc: 5 Argv: `)' Length: 1 Space: ` ' Class: Closing Punctuation or suffix MACRO REQUEST: .Op Fl aC Ar file ) DEBUGGING OFF

The first line of information tells the name of the calling macro, here .Ql .Op , and the line number it appears on. If one or more files are involved (especially if text from another file is included) the line number may be bogus. If there is only one file, it should be accurate. The second line gives the argument count, the argument .Pq Ql Fl and its length. If the length of an argument is two characters, the argument is tested to see if it is executable (unfortunately, any register which contains a nonzero value appears executable). The third line gives the space allotted for a class, and the class type. The problem here is the argument aC should not be executable. The four types of classes are string, executable, closing punctuation and opening punctuation. The last line shows the entire argument list as it was read. In this next example, the offending .Ql aC is escaped:

d -literal -offset indent .Db on .Em An escaped \&aC .Db off

d -literal -offset indent DEBUGGING ON DEBUG(fargv) MACRO: `.Em' Line #: 2 Argc: 1 Argv: `An' Length: 2 Space: ` ' Class: String Argc: 2 Argv: `escaped' Length: 7 Space: ` ' Class: String Argc: 3 Argv: `aC' Length: 2 Space: ` ' Class: String MACRO REQUEST: .Em An escaped &aC DEBUGGING OFF

The argument .Ql \&aC shows up with the same length of 2 as the .Ql \& sequence produces a zero width, but a register named .Ql \&aC was not found and the type classified as string.

Other diagnostics consist of usage statements and are self explanatory.


The -mdoc package does not need compatibility mode with groff .

The package inhibits page breaks, and the headers and footers which normally occur at those breaks with nroff , to make the manual more efficient for viewing on-line. At the moment, groff with - T Ns Ar ascii does eject the imaginary remainder of the page at end of file. The inhibiting of the page breaks makes nroff Ns 'd files unsuitable for hardcopy. There is a register named .Ql cR which can be set to zero in the site dependent style file .Pa /usr/src/share/tmac/doc-nroff to restore the old style behavior.


-tag -width /usr/share/man0/template.doc -compact
Pa /usr/share/tmac/doc.tmac manual macro package
Pa /usr/share/misc/mdoc.template template for writing a man page
Pa /usr/share/examples/mdoc/* several example man pages

20. BUGS

Undesirable hyphenation on the dash of a flag argument is not yet resolved, and causes occasional mishaps in the .Sx DESCRIPTION section. (line break on the hyphen).

Predefined strings are not declared in documentation.

Section 3f has not been added to the header routines.

.Ql .Nm font should be changed in .Sx NAME section.

.Ql .Fn needs to have a check to prevent splitting up if the line length is too short. Occasionally it separates the last parenthesis, and sometimes looks ridiculous if a line is in fill mode.

The method used to prevent header and footer page breaks (other than the initial header and footer) when using nroff occasionally places an unsightly partially filled line (blank) at the would be bottom of the page.

The list and display macros to not do any keeps and certainly should be able to.


man(1) , troff(1) , groff_mdoc(7) , mdoc(7)