[BACK]Return to roff.7 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/roff.7 between version 1.16 and 1.17

version 1.16, 2010/12/10 20:58:56 version 1.17, 2010/12/18 19:32:08
Line 20 
Line 20 
 .Os  .Os
 .Sh NAME  .Sh NAME
 .Nm roff  .Nm roff
 .Nd roff language reference  .Nd roff language reference for mandoc
 .Sh DESCRIPTION  .Sh DESCRIPTION
 The  The
 .Nm roff  .Nm roff
 language is a general-purpose text-formatting language.  The purpose of  language is a general purpose text formatting language.
 this document is to consistently describe those language constructs  In particular, it serves as the basis for the
 accepted by the  .Xr mdoc 7
   and
   .Xr man 7
   manual formatting macro languages.
   This manual describes the subset of the
   .Nm
   language accepted by the
 .Xr mandoc 1  .Xr mandoc 1
 utility.  It is a work in progress.  utility.
 .Pp  .Pp
 An  Input lines beginning with the control characters
 .Nm  .Sq \&.
 document follows simple rules:  lines beginning with the control  
 characters  
 .Sq \.  
 or  or
 .Sq \(aq  .Sq \(aq
 are parsed for requests and macros.  are parsed for requests and macros.
 Other lines are interpreted within the scope of  These define the document structure, change the processing state
 prior macros:  and manipulate the formatting.
 .Bd -literal -offset indent  Some requests and macros also produce formatted output,
 \&.xx Macro lines change control state.  while others do not.
 Other lines are interpreted within the current state.  .Pp
 .Ed  All other input lines provide free-form text to be printed;
   the formatting of free-form text depends on the respective
   processing context.
 .Sh LANGUAGE SYNTAX  .Sh LANGUAGE SYNTAX
 .Nm  .Nm
 documents may contain only graphable 7-bit ASCII characters, the space  documents may contain only graphable 7-bit ASCII characters, the space
 character, and, in certain circumstances, the tab character.  All  character, and, in certain circumstances, the tab character.
 manuals must have  To produce other characters in the output, use the escape sequences
   documented in the
   .Xr mandoc_char 7
   manual.
   .Pp
   All manuals must have
 .Ux  .Ux
 line terminators.  line terminators.
 .Sh MACRO SYNTAX  .Sh REQUEST SYNTAX
 Requests and macros are arbitrary in length and begin with a control  A request or macro line consists of:
 character,  .Pp
 .Sq \.  .Bl -enum -compact
   .It
   the control character
   .Sq \&.
 or  or
 .Sq \(aq ,  .Sq \(aq
 at the beginning of the line.  at the beginning of the line,
 An arbitrary amount of whitespace may sit between the control character  .It
 and the request or macro name.  optionally an arbitrary amount of whitespace,
 Thus, the following are equivalent:  .It
   the name of the request or the macro, which is one word of arbitrary
   length, terminated by whitespace,
   .It
   and zero or more arguments delimited by whitespace.
   .El
   .Pp
   Thus, the following request lines are all equivalent:
 .Bd -literal -offset indent  .Bd -literal -offset indent
 \&.if  \&.ig end
 \&.\ \ \ \&if  \&.ig    end
   \&.   ig end
 .Ed  .Ed
 .Sh REQUEST REFERENCE  .Sh REQUEST REFERENCE
 This section is a canonical reference of all requests recognized by the  The
 .Xr mandoc 1  .Xr mandoc 1
 .Nm  .Nm
 parser.  parser recognizes the following requests.
 The  Note that the
 .Nm  .Nm
 language defines many more requests and macros not implemented in  language defines many more requests not implemented in
 .Xr mandoc 1 .  .Xr mandoc 1 .
 .Ss \&ad  .Ss \&ad
 Set line adjustment mode.  Set line adjustment mode.
Line 103  It is currently ignored by
Line 124  It is currently ignored by
 .Xr mandoc 1 ,  .Xr mandoc 1 ,
 as are its children.  as are its children.
 .Ss \&de  .Ss \&de
 Define a user-defined  Define a
 .Nm  .Nm
 macro.  macro.
 Its syntax can be either  Its syntax can be either
Line 149  request or
Line 170  request or
 .Nm  .Nm
 macro, but not as a high-level macro.  macro, but not as a high-level macro.
 .Pp  .Pp
 A user-defined macro can be invoked later using the syntax  The macro can be invoked later using the syntax
 .Pp  .Pp
 .D1 Pf . Ar name Op Ar argument Op Ar argument ...  .D1 Pf . Ar name Op Ar argument Op Ar argument ...
 .Pp  .Pp
Line 160  to allow inclusion of blank characters into arguments.
Line 181  to allow inclusion of blank characters into arguments.
 To include the double-quote character into a quoted argument,  To include the double-quote character into a quoted argument,
 escape it from ending the argument by doubling it.  escape it from ending the argument by doubling it.
 .Pp  .Pp
 The line invoking the user-defined macro will be replaced  The line invoking the macro will be replaced
 in the input stream by the  in the input stream by the
 .Ar macro definition ,  .Ar macro definition ,
 replacing all occurrences of  replacing all occurrences of
 .No \e\e$ Ns Ar N ,  .No \e\e$ Ns Ar N ,
 where  where
 .Ar N  .Ar N
 is a digit, by the  is a digit, by the
 .Ar N Ns th Ar argument .  .Ar N Ns th Ar argument .
Line 183  produces
Line 204  produces
 .Pp  .Pp
 in the input stream, and thus in the output: \fI\^XtFree\^\fP.  in the input stream, and thus in the output: \fI\^XtFree\^\fP.
 .Pp  .Pp
 Since user-defined macros and strings share a common string table,  Since macros and user-defined strings share a common string table,
 defining a macro  defining a macro
 .Ar name  .Ar name
 clobbers the user-defined string  clobbers the user-defined string
Line 203  limit the stack depth for expanding macros and strings
Line 224  limit the stack depth for expanding macros and strings
 to a large, but finite number.  to a large, but finite number.
 Do not rely on the exact value of this limit.  Do not rely on the exact value of this limit.
 .Ss \&dei  .Ss \&dei
 Define a user-defined  Define a
 .Nm  .Nm
 macro, specifying the macro name indirectly.  macro, specifying the macro name indirectly.
 The syntax of this macro is the same as that of  The syntax of this request is the same as that of
 .Sx \&de .  .Sx \&de .
 It is currently ignored by  It is currently ignored by
 .Xr mandoc 1 ,  .Xr mandoc 1 ,
 as are its children.  as are its children.
 .Ss \&de1  .Ss \&de1
 Define a user-defined  Define a
 .Nm  .Nm
 macro that will be executed with  macro that will be executed with
 .Nm  .Nm
Line 224  Since
Line 245  Since
 .Xr mandoc 1  .Xr mandoc 1
 does not implement  does not implement
 .Nm  .Nm
 compatibility mode at all, it handles this macro as an alias for  compatibility mode at all, it handles this request as an alias for
 .Sx \&de .  .Sx \&de .
 .Ss \&ds  .Ss \&ds
 Define a user-defined string.  Define a user-defined string.
Line 254  for a
Line 275  for a
 of arbitrary length, or \e*(NN or \e*N if the length of  of arbitrary length, or \e*(NN or \e*N if the length of
 .Ar name  .Ar name
 is two or one characters, respectively.  is two or one characters, respectively.
   Interpolation can be prevented by escaping the leading backslash;
   that is, an asterisk preceded by an even number of backslashes
   does not trigger string interpolation.
 .Pp  .Pp
 Since user-defined strings and macros share a common string table,  Since user-defined strings and macros share a common string table,
 defining a string  defining a string
 .Ar name  .Ar name
 clobbers the user-defined macro  clobbers the macro
 .Ar name ,  .Ar name ,
 and the  and the
 .Ar name  .Ar name
Line 292  If no stack entries are present (e.g., due to no prior
Line 316  If no stack entries are present (e.g., due to no prior
 .Sx \&ie  .Sx \&ie
 calls)  calls)
 then false is assumed.  then false is assumed.
 The syntax of this macro is similar to  The syntax of this request is similar to
 .Sx \&if  .Sx \&if
 except that the conditional is missing.  except that the conditional is missing.
 .Ss \&hy  .Ss \&hy
Line 313  Begins a conditional.
Line 337  Begins a conditional.
 Right now, the conditional evaluates to true  Right now, the conditional evaluates to true
 if and only if it starts with the letter  if and only if it starts with the letter
 .Sy n ,  .Sy n ,
 indicating processing in  indicating processing in nroff style as opposed to troff style.
 .Xr nroff 1  
 style as opposed to  
 .Xr troff 1  
 style.  
 If a conditional is false, its children are not processed, but are  If a conditional is false, its children are not processed, but are
 syntactically interpreted to preserve the integrity of the input  syntactically interpreted to preserve the integrity of the input
 document.  document.
 Thus,  Thus,
 .Pp  .Pp
 .D1 \&.if t \e .ig  .D1 \&.if t .ig
 .Pp  .Pp
 will discard the  will discard the
 .Sq \&.ig ,  .Sq \&.ig ,
 which may lead to interesting results, but  which may lead to interesting results, but
 .Pp  .Pp
 .D1 \&.if t \e .if t \e{\e  .D1 \&.if t .if t \e{\e
 .Pp  .Pp
 will continue to syntactically interpret to the block close of the final  will continue to syntactically interpret to the block close of the final
 conditional.  conditional.
 Sub-conditionals, in this case, obviously inherit the truth value of  Sub-conditionals, in this case, obviously inherit the truth value of
 the parent.  the parent.
 This macro has the following syntax:  This request has the following syntax:
 .Pp  .Bd -literal -offset indent
 .Bd -literal -offset indent -compact  
 \&.if COND \e{\e  \&.if COND \e{\e
 BODY...  BODY...
 \&.\e}  \&.\e}
 .Ed  .Ed
 .Bd -literal -offset indent -compact  .Bd -literal -offset indent
 \&.if COND \e{ BODY  \&.if COND \e{ BODY
 BODY... \e}  BODY... \e}
 .Ed  .Ed
 .Bd -literal -offset indent -compact  .Bd -literal -offset indent
 \&.if COND \e{ BODY  \&.if COND \e{ BODY
 BODY...  BODY...
 \&.\e}  \&.\e}
 .Ed  .Ed
 .Bd -literal -offset indent -compact  .Bd -literal -offset indent
 \&.if COND \e  \&.if COND \e
 BODY  BODY
 .Ed  .Ed
Line 372  evaluate as false.
Line 391  evaluate as false.
 .Pp  .Pp
 If the BODY section is begun by an escaped brace  If the BODY section is begun by an escaped brace
 .Sq \e{ ,  .Sq \e{ ,
 scope continues until a closing-brace macro  scope continues until a closing-brace escape sequence
 .Sq \.\e} .  .Sq \.\e} .
 If the BODY is not enclosed in braces, scope continues until the next  If the BODY is not enclosed in braces, scope continues until
 macro or word.  the end of the line.
 If the COND is followed by a BODY on the same line, whether after a  If the COND is followed by a BODY on the same line, whether after a
 brace or not, then macros  brace or not, then requests and macros
 .Em must  .Em must
 begin with a control character.  begin with a control character.
 It is generally more intuitive, in this case, to write  It is generally more intuitive, in this case, to write
Line 388  bar
Line 407  bar
 \&.\e}  \&.\e}
 .Ed  .Ed
 .Pp  .Pp
 than having the macro follow as  than having the request or macro follow as
 .Pp  .Pp
 .D1 \&.if COND \e{ .foo  .D1 \&.if COND \e{ .foo
 .Pp  .Pp
 The scope of a conditional is always parsed, but only executed if the  The scope of a conditional is always parsed, but only executed if the
 conditional evaluates to true.  conditional evaluates to true.
 .Pp  .Pp
 Note that text subsequent a  Note that text following an
 .Sq \&.\e}  .Sq \&.\e}
 macro is discarded.  escape sequence is discarded.
 Furthermore, if an explicit closing sequence  Furthermore, if an explicit closing sequence
 .Sq \e}  .Sq \e}
 is specified in a free-form line, the entire line is accepted within the  is specified in a free-form line, the entire line is accepted within the
 scope of the prior macro, not only the text preceding the close, with the  scope of the prior request, not only the text preceding the close, with the
 .Sq \e}  .Sq \e}
 collapsing into a zero-width space.  collapsing into a zero-width space.
 .Ss \&ig  .Ss \&ig
Line 422  or
Line 441  or
 .Pp  .Pp
 In the first case, input is ignored until a  In the first case, input is ignored until a
 .Sq \&..  .Sq \&..
 macro is encountered on its own line.  request is encountered on its own line.
 In the second case, input is ignored until the specified  In the second case, input is ignored until the specified
 .Sq Pf . Ar end  .Sq Pf . Ar end
 macro is encountered.  macro is encountered.
Line 447  Otherwise, it only terminates the
Line 466  Otherwise, it only terminates the
 .Ar ignored text ,  .Ar ignored text ,
 and arguments following it or the  and arguments following it or the
 .Sq \&..  .Sq \&..
 macro are discarded.  request are discarded.
 .Ss \&ne  .Ss \&ne
 Declare the need for the specified minimum vertical space  Declare the need for the specified minimum vertical space
 before the next trap or the bottom of the page.  before the next trap or the bottom of the page.
Line 472  Its syntax is as follows:
Line 491  Its syntax is as follows:
 The  The
 .Ar value  .Ar value
 may, at the moment, only be an integer.  may, at the moment, only be an integer.
 The  
 .Ar name  
 is defined up to the next whitespace.  
 So far, only the following register  So far, only the following register
 .Ar name  .Ar name
 is recognised:  is recognised:
Line 482  is recognised:
Line 498  is recognised:
 .It Cm nS  .It Cm nS
 If set to a positive integer value, certain  If set to a positive integer value, certain
 .Xr mdoc 7  .Xr mdoc 7
 macros will behave as if they were defined in the  macros will behave in the same way as in the
 .Em SYNOPSIS  .Em SYNOPSIS
 section.  section.
 Otherwise, this behaviour is unset (even if called within the  If set to 0, these macros will behave in the same way as outside the
 .Em SYNOPSIS  .Em SYNOPSIS
 section itself).  section, even when called within the
 Note that invoking a new  .Em SYNOPSIS
   section itself.
   Note that starting a new
 .Xr mdoc 7  .Xr mdoc 7
 section will unset this value.  section with the
   .Cm \&Sh
   macro will reset this register.
 .El  .El
 .Ss \&so  .Ss \&so
 Include a source file.  Include a source file.
Line 511  and
Line 531  and
 .Qq /.. .  .Qq /.. .
 .Ss \&tr  .Ss \&tr
 Output character translation.  Output character translation.
 This macro is intended to have one argument,  This request is intended to have one argument,
 consisting of an even number of characters.  consisting of an even number of characters.
 Currently, it is ignored including its arguments,  Currently, it is ignored including its arguments,
 and the number of arguments is not checked.  and the number of arguments is not checked.
 .Sh COMPATIBILITY  .Sh COMPATIBILITY
 This section documents compatibility between mandoc and other other  This section documents compatibility between mandoc and other other
 troff implementations, at this time limited to GNU troff  .Nm
   implementations, at this time limited to GNU troff
 .Pq Qq groff .  .Pq Qq groff .
 The term  The term
 .Qq historic groff  .Qq historic groff
 refers to groff versions before the  refers to groff version 1.15.
 .Pa doc.tmac  
 file re-write  
 .Pq somewhere between 1.15 and 1.19 .  
 .Pp  .Pp
 .Bl -dash -compact  .Bl -dash -compact
 .It  .It
 The  The
 .Cm nS  .Cm nS
 request to  register is only compatible with OpenBSD's groff-1.15.
 .Sx \&nr  
 is only compatible with OpenBSD's groff.  
 .It  .It
 Historic groff did not accept white-space buffering the custom END tag  Historic groff did not accept white-space before a custom
 for the  .Ar end
   macro for the
 .Sx \&ig  .Sx \&ig
 macro.  request.
 .It  .It
 The  The
 .Sx \&if  .Sx \&if
 and family would print funny white-spaces with historic groff when  and family would print funny white-spaces with historic groff when
 depending on next-line syntax.  using the next-line syntax.
 .El  .El
   .Sh SEE ALSO
   .Xr mandoc 1 ,
   .Xr man 7 ,
   .Xr mandoc_char 7 ,
   .Xr mdoc 7
   .Rs
   .%A Joseph F. Ossanna
   .%A Brian W. Kernighan
   .%I AT&T Bell Laboratories
   .%T Troff User's Manual
   .%R Computing Science Technical Report
   .%N 54
   .%C Murray Hill, New Jersey
   .%D 1976 and 1992
   .%U http://www.kohala.com/start/troff/cstr54.ps
   .Re
   .Rs
   .%A Joseph F. Ossanna
   .%A Brian W. Kernighan
   .%A Gunnar Ritter
   .%T Heirloom Documentation Tools Nroff/Troff User's Manual
   .%D September 17, 2007
   .%U http://heirloom.sourceforge.net/doctools/troff.pdf
   .Re
   .Sh HISTORY
   The RUNOFF typesetting system was written in PL/1 for the CTSS
   operating system by Jerome ("Jerry") E. Saltzer in 1961.
   It was first used as the main documentation tool by Multics since 1963.
   Robert ("Bob") H. Morris ported it to the GE-635 and called it
   .Nm ,
   Doug McIlroy rewrote it in BCPL in 1969,
   Joseph F. Ossanna rewrote it in PDP-11 assembly in 1973,
   and Brian W. Kernighan rewrote it in C in 1975.
 .Sh AUTHORS  .Sh AUTHORS
 .An -nosplit  .An -nosplit
 This partial  This partial

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

CVSweb