Copyright (C) 2000-2012 |
Manpages GROFF_MDOCSection: Environments, Tables, and Troff Macros (7)Index Return to Main Contents BSD mandoc NAMEgroff_mdoc - reference for groff's mdoc implementationSYNOPSISgroff -m doc file ...DESCRIPTIONA complete reference for writing Ux manual pages with the -mdoc macro package; a content -based and domain -based formatting package for GNU troff(1). Its predecessor, the -man7 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 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 Ux 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. GETTING STARTEDThe material presented in the remainder of this document is outlined as follows:
TROFF IDIOSYNCRASIESThe -mdoc package attempts to simplify the process of writing a man page. Theoretically, one should not have to learn the dirty details of GNU 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 not fast.Macro UsageAs in GNU troff(1), a macro is called by placing a `.' (dot character) at the beginning of a line followed by the two-character (or three-character) name for the macro. There can be space characters between the dot and the macro name (but no tabs). Arguments may follow the macro separated by spaces (again, no tabs). It is the dot character at the beginning of the line which causes GNU troff(1) to interpret the next two (or more) characters as a macro name. A single starting dot followed by nothing is ignored. To place a `.' (dot character) at the beginning of an input line in some context other than a macro invocation, precede the `.' (dot) with the `\&' escape sequence. The `\&' translates literally to a zero-width space, and is never displayed in the output.In general, GNU troff(1) macros accept an unlimited number of arguments (contrary to other versions of troff which can't handle more than nine arguments). In limited cases, arguments may be continued or extended on the next line (See Sx Extended Arguments below). Almost all 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 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 `.' (dot). It is in this manner that many macros are nested; for example the option macro, `.[,] ' may call the flag and argument macros, `- ' and `file ... ' to specify an optional flag with an argument:
To prevent a string from being interpreted as a macro name, precede the string with the escape sequence `\&' :
Here the strings `- ' and `file ... ' 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. This is a technical 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. Passing Space Characters in an ArgumentSometimes it is desirable to give as an argument a string containing one or more blank space characters. This may be necessary to specify arguments to macros which expect particular arrangement of items in the argument list. Additionally, it makes -mdoc working faster. For example, the function macro `.Fn expects ' the first argument to be the name of a function and any remaining arguments to be function parameters. As 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.
One way of passing a string containing blank spaces is to use the hard or
unpaddable space character
`\ For example:
If the `\' before the space resp. the double quotes were omitted, `.Fn would ' see three arguments, and the result would be:
Fn fetch char *str Trailing Blank Space CharactersTroff 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 Ao blank-space Ac Ns Ao end-of-line Ac 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 `\&' escape character. For example, `string\\& .'Escaping Special CharactersSpecial characters like the newline character `\n' are handled by replacing the `\' with `\e' (e.g. `\en' ) to preserve the backslash.Other Possible PitfallsA warning is emitted when an empty input line is found outside of displays (see below). Use `.sp' instead. (Well, it is even better to use -mdoc macros to avoid the usage of low-level commands.)Leading spaces will cause a break and are output directly. Avoid this behaviour if possible. Similarly, do not use more than one space character between words in an ordinary text line; contrary to other text formatters, they are not replaced with a single space. You can't pass `q]' directly as an argument. Use `\*[q]' (or `\*q' ) instead. By default, troff(1) inserts two space characters after a punctuation mark closing a sentence; characters like `)' or `'' are treated transparently, not influencing the sentence-ending behaviour. To change this, insert `\&' before or after the dot: The .Ql . character. .Pp The .Ql \&. character. .Pp .No test . test .Pp .No test. test gives The `.' character As can be seen in the first and third line, -mdoc handles punctuation characters specially in macro arguments. This will be explained in section Sx General Syntax below. In the same way, you have to protect trailing full stops of abbreviations with a trailing zero-width space: `e.g.\&' A comment in the source file of a man page can be either started with `.\' on a single line, `\' after some input, or `\#' anywhere (the latter is a GNU troff(1) extension); the rest of such a line is ignored. A MANUAL PAGE TEMPLATEThe body of a man page is easily constructed from a basic template:.\" The following requests are required for all man pages. .Dd Month day, year .Os [OPERATING_SYSTEM] [version/release] .Dt DOCUMENT_TITLE [section number] [architecture/volume] .Sh NAME .Nm name .Nd one line description of name .\" This next request is for sections 2 and 3 only. .\" .Sh LIBRARY .Sh SYNOPSIS .Sh DESCRIPTION .\" The following requests should be uncommented and .\" used where appropriate. .\" .Sh IMPLEMENTATION NOTES .\" This next request is for sections 2, 3 and 9 function .\" return values only. .\" .Sh RETURN VALUES .\" This next request is for sections 1, 6, 7 and 8 only. .\" .Sh ENVIRONMENT .\" .Sh FILES .\" .Sh EXAMPLES .\" This next request is for sections 1, 6, 7, 8 and 9 only .\" (command return values (to shell) and .\" fprintf/stderr type diagnostics). .\" .Sh DIAGNOSTICS .\" .Sh COMPATIBILITY .\" This next request is for sections 2, 3 and 9 error .\" and signal handling only. .\" .Sh ERRORS .\" .Sh SEE ALSO .\" .Sh STANDARDS .\" .Sh HISTORY .\" .Sh AUTHORS .\" .Sh BUGS The first items in the template are the macros `., ' `., ' and `. ' the document date, the operating system the man page or subject source is developed or modified for, and the man page title (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 ( . )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.CONVENTIONSIn the description of all macros below, optional arguments are put into brackets. An ellipsis ( `...' represents zero or more additional arguments. Alternative values for a parameter are separated with `|' If there are alternative values for a mandatory parameter, braces are used (together with `|' ) to enclose the value set. Meta-variables are specified within angles.Example:
Except stated explicitly, all macros are parsed and callable. Most macros have a default width value which can be used to specify a label width ( -width or offset ( -offset for the `. ' and `. ' macros. It is recommended not to use this rather obscure feature to avoid dependencies on local modifications of the -mdoc package. TITLE MACROSThe title macros are part of the page structure domain but are presented first and separately 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 called once at the very beginning of the document and are used to construct headers and footers only.
INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINSWhat'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 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: .Xx argument1 argument2 ... `.Xx is ' a macro command or request, and anything following it are arguments 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: filter [-flag ] Ao Ar infile Ac Ao Ar outfile Ac Here, filter is the command name and the bracketed string -flag is a flag argument designated as optional by the option brackets. In -mdoc terms, Ao Ar infile Ac and Ao Ar outfile Ac are called meta arguments in this example, the user has to replace the meta expressions given in angle brackets with real file names. Note that in this document meta arguments are used to describe -mdoc commands; in most man pages, meta variables are not specifically written with angle brackets. The macros which formatted the above example: .Nm filter .Op Fl flag .Ao Ar infile Ac Ao Ar outfile Ac In the third case, discussion of commands and command syntax includes both examples above, but may add more detail. The arguments Ao Ar infile Ac and Ao Ar outfile Ac from the example above might be referred to as operands or file arguments Some command line argument lists are quite long:
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 to a flag. Instead the `file ... ' 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: .Nm make .Op Fl eiknqrstv .Op Fl D Ar variable .Op Fl d Ar flags .Op Fl f Ar makefile .Op Fl I Ar directory .Op Fl j Ar max_jobs .Op Ar variable Ns = Ns Ar value .Bk .Op Ar target ... .Ek The `.and ' `.macros ' are explained in Sx Keeps . General SyntaxThe manual domain and general text domain macros share a similar syntax with a few minor deviations; most notably, `.file ... ' `.- ' `.groff Fl m Ns Cm doc Ar ' and `.differ ' only when called without arguments; and `.Fn and ' `.impose ' an order on their argument lists. 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:
.sptr, ptr), The result is:
sptr, ptr), The punctuation is not recognized and all is output in the font used by `.file ... ' If the punctuation is separated by a leading white space:
.sptr , ptr ) , The result is:
sptr , ptr The punctuation is now recognized and output in the default font distinguishing it from the argument strings. To remove the special meaning from a punctuation character escape it with `\&' 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: {+,-,/,*,%,<,>,<=,>=,=,==,&,`,',"} 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 `\&' Typical syntax is shown in the first content macro displayed below, `. ' MANUAL DOMAINAddressesThe address macro identifies an address construct.
Usage: .Ao address Ac ...
Author NameThe `.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.
Usage: .An Ao author name Ac ...
The default width is 12n. In the Sx AUTHORS section, the `.An request ' causes a line break allowing each new name to appear on its own line. If this is not desirable, .An -nosplit call will turn this off. To turn splitting back on, write .An -split ArgumentsThe .file ... argument macro may be used whenever an argument is referenced. If called without arguments, the `file ... ' string is output.
Usage: .[Ao argument Ac ...]
Configuration Declaration (Section Four Only)The `.macro ' is used to demonstrate a config(8) declaration for a device interface in a section four manual.
Usage: .Ao argument Ac ...
In the Sx SYNOPSIS section a `.request ' causes a line break before and after its arguments are printed. Command ModifiersThe command modifier is identical to the `.- ' (flag) command with the exception that the `.macro ' does not assert a dash in front of every argument. Traditionally flags are marked by the preceding dash, however, 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 .Defined VariablesA variable (or constant) which is defined in an include file is specified by the macro `. '
Usage: .Ao defined variable Ac ...
Errno'sThe `.Er errno ' macro specifies the error return value for section 2, 3, and~9 library routines. The second example below shows `.Er used ' with the `.Bq general ' text domain macro, as it would be used in a section two manual page.
Usage: .Er Ao errno type Ac ...
Environment VariablesThe `.macro ' specifies an environment variable.
Usage: .Ao argument Ac ...
FlagsThe `.- ' macro handles command line flags. It prepends a dash, `-' , to the flag. For interactive command flags, which are not prepended with a dash, the `.(command ' modifier) macro is identical, but without the dash.
Usage: .-Ao argument Ac ...
The `.- ' macro without any arguments results in a dash representing stdin/stdout. Note that giving `.- ' a single dash will result in two dashes. Function DeclarationsThe `.Fd macro ' is used in the Sx SYNOPSIS section with section two or three functions. It is neither callable nor parsed.
Usage: .Fd Ao argument Ac ...
In the Sx SYNOPSIS section a `.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. The `.In ( ' #include statement) macro is the short form of the above example. It specifies the C~header file as being included in a C~program. It also causes a line break, and is neither callable nor parsed.
Usage: .In Ao header file Ac
Function TypesThis 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).
Usage: .Ft Ao type Ac ...
Functions (Library Routines)The `.Fn macro ' is modeled on ANSI~C conventions.
Usage: .Fn Ao function Ac [Ao parameter Ac ...]
Note that any call to another macro signals the end of the `.Fn call ' (it will insert a closing parenthesis at that point). For functions with many parameters (which is rare), the macros `.Fo (function ' open) and `.Fc (function ' close) may be used with `.Fa (function ' argument). Example: .Ft int .Fo 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 Produces: Ft int Fo 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 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. The default width values of `.Fn and ' `.Fo are ' 12n and 16n, respectively. Function ArgumentsThe `.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 if the enclosure macros `.Fo and ' `.Fc instead ' of `.Fn are ' used. `.Fa may ' also be used to refer to structure members.
Usage: .Fa Ao function argument Ac ...
Return ValuesThe `.Rv macro ' generates text for use in the Sx RETURN VALUES section.
Usage: .Rv [-std Ao function AcFor example, `.Rv -std ' atexit produces: # a small hack to suppress a warning message Rv -std atexit The -std option is valid only for manual page sections~2 and~3. Currently, this macro does nothing if used without the -std flag. Interactive CommandsThe `.macro ' designates an interactive or internal command.
Usage: .Ao argument Ac ...
Library NamesThe `.Lb macro ' is used to specify the library where a particular function is compiled in.
Usage: .Lb Ao argument Ac ... Available arguments to `.Lb and ' their results are:
Local, OS-specific additions might be found in the file mdoc.local look for strings named `str-Lb-XXX' `XXX' then denotes the keyword to be used with the `.Lb macro. ' LiteralsThe `.literal ' macro may be used for special characters, variable constants, etc. -- anything which should be displayed as it would be typed.
Usage: .Ao argument Ac ...
NamesThe `.groff Fl m Ns Cm doc Ar ' 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, `.groff Fl m Ns Cm doc Ar ' 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 `.groff Fl m Ns Cm doc Ar ' in the Sx NAME section, and with `.Fn in ' the Sx SYNOPSIS and remaining sections. For interactive commands, such as the `while' command keyword in csh(1), the `.macro ' should be used. While `.is ' nearly identical to `.groff Fl m Ns Cm doc Ar ' it can not recall the first argument it was invoked with.
Usage: .[Ao argument Ac ...]
OptionsThe `.[macro] ' places option brackets around any remaining arguments on the command line, and places any trailing punctuation outside the brackets. The macros `.[and ' `.] ' (which produce an opening and a closing option bracket respectively) may be used across one or more lines or to specify the exact position of the closing parenthesis.
Usage: .[[Ao option Ac ...] ]
Here a typical example of the `.[and ' `.] ' macros: .Oo .Op Fl k Ar kilobytes .Op Fl i Ar interval .Op Fl c Ar count .Oc Produces: [[-k kilobytes ] [-i interval ] [-c count ] ] The default width values of `.[and] ' `.[are ' 14n and 10n, respectively. PathnamesThe `.macro ' formats path or file names. If called without arguments, the `string is output, which represents the current user's home directory. '
Usage: .[Ao pathname Ac ...]
StandardsThe `.St macro ' replaces standard abbreviations with their formal names.
Usage: .St Ao abbreviation Ac ... Available pairs for ``Abbreviation/Formal Name'' are: ANSI/ISO C
POSIX Part 1: System API
POSIX Part 2: Shell and Utilities
X/Open
Miscellaneous
Variable TypesThe `.Vt macro ' may be used whenever a type is referenced. In the Sx SYNOPSIS section, it causes a line break (useful for old style variable declarations).
Usage: .Vt Ao type Ac ...
VariablesGeneric variable reference.
Usage: .Ao variable Ac ...
Manual Page Cross ReferencesThe `.macro ' expects the first argument to be a manual page name. The optional second argument, if a string (defining the manual section), is put into parentheses.
Usage: .AomanpagenameAcOoAosectionAcOc...
GENERAL TEXT DOMAINAT&T Macro
Usage: .At [Ao version Ac ...]
The following values for Ao version Ac are possible:
32v, v1, v2, v3, v4, v5, v6, v7, V, V.1, V.2, V.3, V.4 BSD Macro
"Usage: .Bx" Bro -alpha | -beta | -devel Brc ... " .Bx" [Ao version Ac [Ao release Ac ...] ]
Ao version Ac will be prepended to the string `BSD ' The following values for Ao release Ac are possible:
Reno, reno, Tahoe, tahoe, Lite, lite, Lite2, lite2 NetBSD Macro
Usage: .Nx [Ao version Ac ...]
For possible values of Ao version Ac see the description of the `.request ' above in section Sx TITLE MACROS . FreeBSD Macro
Usage: .Fx [Ao version Ac ...]
For possible values of Ao version Ac see the description of the `.request ' above in section Sx TITLE MACROS . OpenBSD Macro
Usage: .Ox [Ao version Ac ...]
BSD/OS Macro
Usage: .Bsx [Ao version Ac ...]
UNIX Macro
Usage: .Ux ...
Emphasis MacroText may be stressed or emphasized with the `.macro. ' The usual font for emphasis is italic.
Usage: .Ao argument Ac ...
Font ModeThe `.Bf font ' mode must be ended with the `.Ef macro ' (the latter takes no arguments). Font modes may be nested within other font modes.`.Bf has ' the following syntax:
.Bf Ao font mode AcAo font mode Ac must be one of the following three types:
Both macros are neither callable nor parsed. Enclosure and Quoting MacrosThe 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 `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 `o' and `c' respectively.# XXX Quote Ta Open Ta Close Ta Function Ta Result .Aq Ta .Ao Ta .Ac Ta Angle Bracket Enclosure Ta Ao string Ac .Bq Ta .Bo Ta .Bc Ta Bracket Enclosure Ta Bo string Bc .Brq Ta .Bro Ta .Brc Ta Brace Enclosure Ta Bro string Brc .``Ta .Do Ta .Dc Ta Double Quote Ta Do string Dc .Eq Ta .Eo Ta .Ec Ta Enclose String (in XX) Ta XXstringXX '' .(Ta .Po Ta .Pc Ta Parenthesis Enclosure Ta Po string Pc .`Ta Ta Ta Quoted ' ) Literal Ta So string Sc or Li string .Qq Ta .Qo Ta .Qc Ta Straight Double Quote Ta Qo string Qc .`Ta .So Ta .Sc Ta Single Quote Ta So string Sc ' All macros ending with `q' and `o' have a default width value of 12n.
Examples of quoting:
For a good example of nested enclosure macros, see the `.[option] ' macro. It was created from the same underlying enclosure macros as those presented in the list above. The `.Xo and ' `.extended ' argument list macros are discussed below. No-[or Normal Text Macro]The `.macro ' can be used in a macro command line for parameters which should not be formatted. Be careful to add `\&' to the word `if ' you really want that English word (and not the macro) as a parameter.
Usage: .Ao argument Ac ...
No-Space MacroThe `.macro ' suppresses insertion of a space between the current position and its first parameter. For example, it is useful for old style argument lists where there is no space between the flag and argument:
"Usage:" ... Ao argument Ac [Ao argument Ac ...] " " .Ao argument Ac ...
Note: The `.macro ' always invokes the `.macro ' after eliminating the space unless another macro name follows it. If used as a request (i.e., the second form above in the `Usage' line, `.is ' identical to `. ' Section Cross ReferencesThe `.Sx macro ' designates a reference to a section header within the same document.
Usage: .Sx Ao section reference Ac ...
SymbolicsThe symbolic emphasis macro is generally a boldface macro in either the symbolic sense or the traditional English usage.
Usage: .Ao symbol Ac ...
Mathematical SymbolsUse this macro for mathematical symbols and similar things.
Usage: .Ao math symbol Ac ...
References and CitationsThe following macros make a modest attempt to handle references. At best, the macros make it convenient to manually drop in a subset of refer(1) style references.
Trade Names (or Acronyms and Type Names)The trade name macro prints its arguments in a smaller font. Its intended use is to imitate a small caps fonts for uppercase acronyms.
Usage: .Ao symbol Ac ...
Extended ArgumentsThe .Xo and .macros allow one to extend an argument list on a macro boundary for the `. ' macro (see below). Note that .Xo and .are implemented similarly to all other macros opening and closing an enclosure (without inserting characters, of course). This means that the following is true for those macros also.Here is an example of `.Xo using ' the space mode macro to turn spacing off: .Sm off .It Xo Sy I Ar operation .No \en Ar count No \en .Xc .Sm on produces
Another one: .Sm off .It Cm S No / Ar old_pattern Xo .No / Ar new_pattern .No / Op Cm g .Xc .Sm on produces
Another example of `.Xo and ' enclosure macros: Test the value of a variable. .It Xo .Ic .ifndef .Oo \&! Oc Ns Ar variable Oo .Ar operator variable ... .Oc Xc produces
PAGE STRUCTURE DOMAINSection HeadersThe following `.section' header macros are required in every man page. The remaining section headers are recommended at the discretion of the author writing the manual page. The `.macro' is parsed but not generally callable. It can be used as an argument in a call to `.only;' it then reactivates the default font for `. 'The default width is 8n.
NAMENAME' macro is mandatory. If not specified, 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 `.groff Fl m Ns Cm doc Ar ' name macro naming the subject of the man page. The second is the name description macro, `. - , ' 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.`. - first ' prints `-' , then all its arguments. Li ".Sh LIBRARY" This section is for section two and three function calls. It should consist of a single `.Lb macro ' call; see Sx Library Names . Li ".Sh SYNOPSIS" The Sx SYNOPSIS section describes the typical usage of the subject of a man page. The macros required are either `.groff Fl m Ns Cm doc Ar ' `., ' or `.Fn (and ' possibly `.Fo , ' `.Fc , ' `.Fd , ' and `.Ft ) ' The function name macro `.Fn is ' required for manual page sections~2 and~3; the command and general name macro `.groff Fl m Ns Cm doc Ar ' is required for sections 1, 5, 6, 7, and~8. Section~4 manuals require a `.groff Fl m Ns Cm doc Ar ' `.Fd or ' a `.configuration ' device usage macro. Several other macros may be necessary to produce the synopsis line as shown below: cat [-benstuv ] [- ] file ... The following macros were used:
".cat ".[-benstuv ] ".[Fl] .file ...Li ".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 `.
' (begin list), `. ' (end list) macros are used (see Sx Lists and Columns below). Li ".Sh IMPLEMENTATION NOTES" Implementation specific information should be placed here. Li ".Sh RETURN VALUES" Sections 2, 3 and~9 function return values should go here. The `.Rv macro ' may be used to generate text for use in the Sx RETURN VALUES section for most section 2 and 3 library functions; see Sx Return Values .
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.
ENVIRONMENTIt is recommended that the cross references are sorted on the section number, then alphabetically on the names within a section, and placed in that order and comma separated. Example: ls(1), ps(1), group(5), passwd(5) Li ".Sh STANDARDS" If the command, library function or file adheres to a specific implementation such as St -p1003.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. Li ".Sh HISTORY" Any command which does not adhere to any specific standards should be outlined historically in this section. Li ".Sh AUTHORS" Credits should be placed here. The `.An macro ' should be used to specify the name(s) of the person(s). Li ".Sh BUGS" Blatant problems with the topic go here.
sections' may be added; for example, this section was set with:.Sh "PAGE STRUCTURE DOMAIN" Subsection HeadersSubsection headers have exactly the same syntax as section headers: `.is' parsed but not generally callable. It can be used as an argument in a call to `.only;' it then reactivates the default font for `. 'Paragraphs and Line Spacing
or' `.macro' or before a `.' or `. ' macro (which both assert a vertical distance unless the -compact flag is given). The macro is neither callable nor parsed and takes no arguments; an alternative name is `.Lp ' KeepsThe only keep that is implemented at this time is for words. The macros are `.(begin ' keep) and `.(end ' keep). The only option that `.accepts ' currently is -words (this is also the default if no option is given) which 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.Both macros are neither callable nor parsed. More work needs to be done with the keep macros; specifically, a -line option should be added. Examples and DisplaysThere are seven types of displays.
Lists and ColumnsThere are several types of lists which may be initiated with the `.
' begin-list macro. Items within the list are specified with the `. ' macro. Lists may be nested within themselves and within displays. The use of columns inside of lists or lists inside of columns is unproven. 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 ( -tag It has the following syntax forms:
] ] And now a detailed description of the list types.
Other keywords:
MISCELLANEOUS MACROSHere a list of the remaining macros which do not fit well into one of the above sections. We couldn't find real examples for the following macros: `.Me and ' `.Ot ' They are documented here for completeness - if you know how to use them properly please send a mail to Mt bug-groff@gnu.org (including an example).
PREDEFINED STRINGSThe following strings are predefined:
The names of the columns Nroff and Troff are a bit misleading; Nroff shows the ASCII representation, while Troff gives the best glyph form available. For example, a Unicode enabled TTY - device will have proper glyph representations for all strings, whereas the enhancement for a Latin1 TTY - device is only the plus-minus sign. String names which consist of two characters can be written as `\*(xx' ; string names which consist of one character can be written as `\*x' A generic syntax for a string name of any length is `\*[xxx]' (this is a GNU troff(1) extension). # #===================================================================== # DIAGNOSTICSThe debugging macro `.Db available ' in previous versions of -mdoc has been removed since GNU troff(1) provides better facilities to check parameters; additionally, many error and warning messages have been added to this macro package, making it both more robust and verbose.The only remaining debugging macro is `.Rd which ' yields a register dump of all global registers and strings. A normal user will never need it. FORMATTING WITH GROFF, TROFF, AND NROFFBy default, the package inhibits page breaks, headers, and footers if displayed with a TTY device like `latin1' or `unicode' to make the manual more efficient for viewing on-line. This behaviour can be changed (e.g. to create a hardcopy of the TTY output) by setting the register `cR' to zero while calling groff:
groff -Tlatin1 -rcR=0 -mdoc foo.man > foo.txt For double-sided printing, set register `D' to~1:
groff -Tps -rD1 -mdoc foo.man > foo.ps To change the document font size to 11pt or 12pt, set register `S' accordingly:
groff -Tdvi -rS11 -mdoc foo.man > foo.dvi Register `S' is ignored for TTY devices. FILES
SEE ALSOgroff(1), man(1), troff(1), groff_man7BUGSSection 3f has not been added to the header routines.`.groff Fl m Ns Cm doc Ar ' font should be changed in Sx NAME section. `.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 list and display macros do not do any keeps and certainly should be able to.
Index
This document was created by man2html, using the manual pages. Time: 22:42:22 GMT, December 09, 2024 |