Copyright (C) 2000-2012 |
Manpages MDOC.SAMPLESSection: Environments, Tables, and Troff Macros (7)Index Return to Main Contents BSD mandoc NAMEmdoc.samples - tutorial sampler for writing BSD manuals with -mdocSYNOPSISman mdoc.samplesDESCRIPTIONA tutorial sampler for writing BSD manual pages with the -mdoc macro package, a content -based and domain -based formatting package for 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 BSD 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 STARTEDSince 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:
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 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 troff(1), a macro is called by placing a `.' (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 `.' (dot character) at the beginning of a 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, 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 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 two character 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 and in the companion quick reference manual mdoc(7). 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 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 `.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. 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 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:
One way of passing a string
containing blank spaces is to use the hard or unpaddable space character
`\
If the `\' or quotes were omitted, `.Fn would ' see three arguments and the result would be:
Fn fetch char *str For an example of what happens when the parameter list overlaps a newline boundary, see the Sx BUGS section. 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 <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 `\&' 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.THE ANATOMY OF A MAN PAGEThe body of a man page is easily constructed from a basic template found in the file /usr/share/misc/mdoc.template Several example man pages can also be found in /usr/share/examples/mdocA manual page template.\" The following requests are required for all man pages. .Dd Month day, year .Os OPERATING_SYSTEM [version/release] .Dt DOCUMENT_TITLE [section number] [volume] .Sh NAME .Nm name .Nd one line description of name .Sh SYNOPSIS .Sh DESCRIPTION .\" The following requests should be uncommented and .\" used where appropriate. This next request is .\" for sections 2 and 3 function return values only. .\" .Sh RETURN VALUES .\" This next request is for sections 1, 6, 7 & 8 only .\" .Sh ENVIRONMENT .\" .Sh FILES .\" .Sh EXAMPLES .\" This next request is for sections 1, 6, 7 & 8 only .\" (command return values (to shell) and .\" fprintf/stderr type diagnostics) .\" .Sh DIAGNOSTICS .\" The next request is for sections 2 and 3 error .\" and signal handling only. .\" .Sh ERRORS .\" .Sh SEE ALSO .\" .Sh CONFORMING TO .\" .Sh HISTORY .\" .Sh AUTHORS .\" .Sh BUGS The first items in the template are the macros (., ., . ) 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.TITLE MACROSThe 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.
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: .Va argument1 argument2 ... argument9 The `.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: filter [-flag ] infile outfile 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, infile and outfile are called arguments The macros which formatted the above example: .Nm filter .Op Fl flag .Ar 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 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=value .Bk -words .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: `.file ... ' `.- ' `.man mdoc.samples ' and `.differ ' only when called without arguments; `.Fn and ' `.impose ' an order on their argument lists and the `.[and] ' `.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 an request is given:
.sptr, ptr), The result is:
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:
.sptr , ptr ) , The result is:
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 `\&' 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 DOMAINAddress MacroThe address macro identifies an address construct of the form addr1[,addr2[,addr3]].
Usage: .address ...
It is an error to call `.without ' arguments. `.is ' callable by other macros and is parsed. 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. Any remaining arguments after the name information are assumed to be punctuation.
Usage: .An author_name
The `.An macro ' is parsed and is callable. It is an error to call `.An without ' any arguments. Argument MacroThe `.file ... ' argument macro may be used whenever a command line argument is referenced.
Usage: .argument ...
If `.file ... ' is called without arguments `file ... ' is assumed. The `.file ... ' macro is parsed and is callable. Configuration Declaration (section four only)The `.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).
Command ModifierThe command modifier is identical to the `.- ' (flag) command with the exception the `.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 .Defined VariablesA variable which is defined in an include file is specified by the macro `. '
Usage: .defined_variable ...
It is an error to call `.without ' arguments. `.is ' parsed and is callable. Errno's (Section two only)The `.Er errno ' macro specifies the error return value for section two 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 ERRNOTYPE ...
It is an error to call `.Er without ' arguments. The `.Er macro ' is parsed and is callable. Environment VariablesThe `.macro ' specifies an environment variable.
Usage: .argument ...
It is an error to call `.without ' arguments. The `.macro ' is parsed and is callable. Function ArgumentThe `.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 `.Fn macro ' and the enclosure macros `.Fo and ' `.Fc must ' be used. `.Fa may ' also be used to refer to structure members.
Usage: .Fa function_argument ...
It is an error to call `.Fa without ' arguments. `.Fa is ' parsed and is callable. Function DeclarationThe `.Fd macro ' is used in the Sx SYNOPSIS section with section two or three functions. The `.Fd macro ' does not call other macros and is not callable by other macros.
Usage: .Fd include_file (or defined variable) 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. 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: .-argument ...
The `.- ' macro without any arguments results in a dash representing stdin/stdout. Note that giving `.- ' a single dash, will result in two dashes. The `.- ' macro is parsed and is callable. Functions (library routines)The .Fn macro is modeled on ANSI C conventions.Usage: .Fn [type] function [[type] parameters ... ]
It is an error to call `.Fn without ' any arguments. The `.Fn macro ' is parsed and is callable, note that any call to another macro signals the end of the `.Fn call ' (it will close-parenthesis at that point). For functions that have more than eight parameters (and this is rare), the macros `.Fo (function ' open) and `.Fc (function ' close) may be used with `.Fa (function ' argument) to get around the limitation. For example: .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 Produces: 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 `.Fo and ' `.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, `.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. Function TypeThis 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 type ...
The `.Ft request ' is not callable by other macros. Interactive CommandsThe `.macro ' designates an interactive or internal command.
Usage: .argument ...
It is an error to call `.without ' arguments. The `.macro ' is parsed and is callable. Name MacroThe `.man mdoc.samples ' 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, `.man mdoc.samples ' 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 `.man mdoc.samples ' 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 the `.is ' nearly identical to `.man mdoc.samples ' it can not recall the first argument it was invoked with.
Usage: .argument ...
The `.man mdoc.samples ' macro is parsed and is callable. OptionsThe `.[macro] ' places option brackets around the any remaining arguments on the command line, and places any trailing punctuation outside the brackets. The macros `.] ' and `.[may ' be used across one or more lines.
Usage: .[options ... ]
The `.] ' and `.[macros: ' .Oo .Op Fl k Ar kilobytes .Op Fl i Ar interval .Op Fl c Ar count .Oc Produce: [[-k kilobytes ] [-i interval ] [-c count ] ] The macros `.[,] ' `.] ' and `.[are ' parsed and are callable. PathnamesThe `.macro ' formats path or file names.
Usage: .pathname
The `.macro ' is parsed and is callable. VariablesGeneric variable reference:
Usage: .variable ...
It is an error to call `.without ' any arguments. The `.macro ' is parsed and is callable. Manual Page Cross ReferencesThe `.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.
Usage: .man_page[1,...,8]
The `.macro ' is parsed and is callable. It is an error to call `.without ' any arguments. GENERAL TEXT DOMAINAT&T MacroUsage: .At [v6 | v7 | 32v | V.1 | V.4] ...
The `.At macro ' is not parsed and not callable. It accepts at most two arguments. BSD MacroUsage: .BSD [Version/release] ...
The `.BSD macro ' is parsed and is callable. FreeBSD MacroUsage: .Fx Version.release ...
The `.Fx macro ' is not parsed and not callable. It accepts at most two arguments. UNIX MacroUsage: .Ux ...
The `.Ux macro ' is parsed and is callable. 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. 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.
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.
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 were also built from the same underlying routines and are a good example of -mdoc macro usage at its worst. No-[or Normal Text Macro]The macro `.is ' a hack for words in a macro command line which should not be formatted and follows the conventional syntax for content macros.Space MacroThe `.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:
Note: the `.macro ' always invokes the `.macro ' after eliminating the space unless another macro name follows it. The macro `.is ' parsed and is callable. Section Cross ReferencesThe `.Sx macro ' designates a reference to a section header within the same document. It is parsed and is callable.
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 style references.
The macros beginning with `%' 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 troffNs/NsXrditroff output. Return ValuesThe `.Rv macro ' generates text for use in the Sx RETURN VALUES section.
Usage: .Rv [-std function] `.Rv -std ' atexit will generate the following text: Rv -std atexit The -std option is valid only for manual page sections 2 and 3. 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.
Usage: .symbol ...
The `.macro ' is parsed and is callable by other macros. Extended ArgumentsThe `.Xo and ' `.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 `.[] '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 ' using enclosure macros: Test the value of an variable. .It Xo .Ic .ifndef .Oo \&! Oc Ns Ar variable .Op Ar operator variable ... .Xc Produces
All of the above examples have used the `.Xo macro ' on the argument list of the `. ' (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 `.Xo and ' `.macros ' are placed as shown in the third example. If the `.Xo macro ' is not alone on the `. ' argument list, spacing will be unpredictable. The `.(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 BSD only fifteen use the `.Xo macro. ' PAGE STRUCTURE DOMAINSection HeadersThe first three `.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 `.macro' can take up to nine arguments. It is parsed and but is not callable.
NAMENAME' 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 `.man mdoc.samples ' 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. .Sh SYNOPSIS The Sx SYNOPSIS section describes the typical usage of the subject of a man page. The macros required are either `.Nm' , `.Cd' , `.Fn' , (and possibly `.Fo' , `.Fc' , `.Fd' , `.Ft' macros). The function name macro `.Fn' is required for manual page sections 2 and 3, the command and general name macro `.man mdoc.samples ' is required for sections 1, 5, 6, 7, 8. Section 4 manuals require a `.Nm' , `.Fd' or a `.Cd' 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 ] .[- ] .file ... Note The macros `.[,] ' `.- ' and `.file ... ' recognize the pipe bar character `' so a command line such as:
".[-a | -b ] will not go orbital. Troff normally interprets a as a special operator. See Sx PREDEFINED STRINGS for a usable 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 `.
' begin-list, `. ' end-list macros are used (see Sx Lists and Columns below).
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.
ENVIRONMENTls(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 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. .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 `.Er macro ' is used to specify an errno. .Sh BUGS Blatant problems with the topic go here...
sections' may be added, for example, this section was set with:.Sh PAGE STRUCTURE DOMAIN Paragraphs and Line Spacing.
or' `.macro' or before a `.' macro. (The `. ' macro asserts a vertical distance unless the -compact flag is given).
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 ' 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.)Examples and DisplaysThere are five types of displays, a quickie one line indented display `.D1' , a quickie one line literal display `.,' and a block literal, block filled and block ragged which use the `. ' begin-display and `. ' end-display macros.
Font ModesThere are five macros for changing the appearance of the manual page text:
Tagged Lists and ColumnsThere are several types of lists which may be initiated with the `.Bl' begin-list macro. Items within the list are specified with the `.It' item macro and each list must end with the `.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 (-tag ) For a change of pace, the list-type used to present the list-types is an over-hanging list (-ohang ) This type of list is quite popular with TeX users, but might look a bit funny after having read many pages of tagged lists. The following list types are accepted by `.Bl' :
PREDEFINED STRINGSThe following strings are predefined as may be used by preceding with the troff string interpreting sequence `\*(xx' where xx is the name of the defined string or as `\*x' where x is the name of the string. The interpreting sequence may be used any where in the text.
Note
DIAGNOSTICSThe 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 `file ... ' <lower_case><upper_case> as `aR' or <upper or lower letter><digit> as `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 meta-character character. In one of the introduction examples, it was shown how to prevent the interpretation of a macro name with the escape sequence `\&' This is sufficient for the internal register names also.If a non-escaped 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 `.Db (debug) ' macro displays the interpretation of the argument list for most macros. Macros such as the `. ' (paragraph) macro do not contain debugging information. All of the callable macros do, and it is strongly advised whenever in doubt, turn on the `.Db macro. '
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 `aC' which should be `\&aC' in order to work): .Db on .Op Fl aC Ar file ) .Db off The resulting output: 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 `.[,] ' 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 (`- ' ) 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 non-zero 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 `aC' is escaped: .Db on .Em An escaped \&aC .Db off 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 `\&aC' shows up with the same length of 2 as the `\&' sequence produces a zero width, but a register named `\&aC' was not found and the type classified as string. Other diagnostics consist of usage statements and are self explanatory. GROFF, TROFF AND NROFFThe -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 ascii does eject the imaginary remainder of the page at end of file. The inhibiting of the page breaks makes nroffNs'd files unsuitable for hardcopy. There is a register named `cR' which can be set to zero in the site dependent style file /usr/src/share/tmac/doc-nroff to restore the old style behavior. FILES
SEE ALSOman(1), troff(1), mdoc(7)BUGSUndesirable 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. `.man mdoc.samples ' 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 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.
Index
This document was created by man2html, using the manual pages. Time: 23:33:01 GMT, December 09, 2024 |