aboutsummaryrefslogtreecommitdiff
path: root/rf.1
diff options
context:
space:
mode:
Diffstat (limited to 'rf.1')
-rw-r--r--rf.1187
1 files changed, 110 insertions, 77 deletions
diff --git a/rf.1 b/rf.1
index fbf429f..680bd4b 100644
--- a/rf.1
+++ b/rf.1
@@ -20,7 +20,7 @@ in a couple important ways:
.Bl -enum
.It
References are not stored in a separate file.
-They are defined via macros in the troff document itself, usually at the end.
+They are defined via macros at the end of the troff document itself.
.Pp
This means that you can move, copy and share your troff document without needing to worry about an additional reference file.
Furthermore, you never run the risk of accidentally losing the references attached to a document.
@@ -56,27 +56,43 @@ I would deem it rare to have more than a couple of hundred unique references in
.Nm
is controlled by several macros, all consisting of one uppercase and one lowercase letter, beginning with either an
.Sq F
-(format macros)
or an
+.Sq R .
+Macros beginning with
.Sq R
-(inline reference and reference list macros).
-These are listed below in alphabetical order.
+control the two primary
+.Dq units
+of
+.Nm :
+.Bl -enum
+.It
+.Em entries
+in the reference list, and
+.It
+.Em inline references
+to these entries.
+.El
+.Pp
+Macros beginning with
+.Sq F ,
+in turn, control the appearance of these two units.
.Ss Format macros
+You can control the appearance of your references as they are displayed in-line as well as in the final reference list by using the format macros.
.Bl -tag
+.It Sy \&Fe
+Defines the format for reference list entries.
+.Pp
+Default: %a (%y). {\\fI%t\\fR}. {\\*Q%q\\*U}. %n, %d. %c: %p. {Available: %w.}
.It Sy \&Ff
Defines the format for
.Dq full
-inline references, which usually contain both author and year.
+inline references, which by default contain both author and year.
.Pp
-Default: (%a %y)
-.It Sy \&Fl
-Defines the format for the reference list, which is usually located at the end of the document.
-.Pp
-Default: %a (%y). {\\fI%t\\fR}. {\\*Q%q\\*U}. %n, %d. %c: %p. {Available: %w.}
+Default: (%A %y)
.It Sy \&Fx
Defines the format for
.Dq alternate
-inline references, which usually contain only the year.
+inline references, which by default contain only the year.
.Pp
Default: (%y)
.El
@@ -84,51 +100,21 @@ Default: (%y)
For a description of the format syntax, see
.Sx FORMAT SYNTAX .
.
-.Ss Inline reference macros
-.Bl -tag
-.It Sy \&Rf
-Inserts a
-.Dq full
-inline reference, which usually contains both author and year.
-.It Sy \&Rx
-Inserts an
-.Dq alternate
-inline reference, which usually contains only the year.
-.El
-.Pp
-What reference to refer to is specified by the rest of the line.
-It is matched against the author, year and title of all references to find a match.
-If only a weak match is found, a warning is printed on standard error.
-.Pp
-To include some punctuation character immediately after the inline reference, add a space before it:
-.Bd -literal -offset indent
-\&.Rf Johnson 92 .
-.Ed
-.Pp
-To wrap the inline reference in parentheses, use the following syntax:
-.Bd -literal -offset indent
-\&.Rf Johnson 92 ) (
-.Ed
-.Pp
-Additionally, any instance of
-.Li ''
-is replaced with the last word on the preceding line.
-This allows the following shortcut:
-.Bd -literal -offset indent
-According to Johnson
-\&.Rx '' 92 ,
-there has been a gradual change in attitudes towards ...
-.Ed
-.
-.Ss Reference list macros
+.Ss Entry definition macros
+In the reference list, each entry is defined by a
+.Sy contiguous
+block of lines containing definition macros, describing various
+.Em fields
+belonging to the reference,
+such as author and year.
+The definition of one reference is separated from that of another by any other lines,
+.Sy including
+text lines and empty lines.
.Bl -tag
.It Sy \&Ra
Adds to the list of
.Em authors
of the current reference.
-Additionally,
-.Sy \&Ra
-marks the beginning of a new reference.
.Pp
Format: Surname(s), Forename(s)
.It Sy \&Rc
@@ -158,7 +144,7 @@ of an article.
Defines the
.Em title
of a book.
-.Ìt Sy \&Rw
+.It Sy \&Rw
Defines the (web)
.Em address
of an online resource.
@@ -174,47 +160,93 @@ prints a formatted version of each reference entry in place of its definition.
.Nm
does not change the order of reference entries.
This means that you can arrange your references freely.
+.
+.Ss Inline reference macros
+To insert an inline reference to an entry in the reference list, you can use one of two macros:
+.Bl -tag
+.It Sy \&Rf
+Inserts a
+.Dq full
+inline reference, which usually contains both author and year.
+.It Sy \&Rx
+Inserts an
+.Dq alternate
+inline reference, which usually contains only the year.
+.El
+.Pp
+What reference to refer to is specified by the rest of the line.
+Each word of it is matched against the author, year and title of all references to find a match.
+If only a weak match is found, a warning is printed on standard error.
+.Pp
+To include some punctuation character immediately after the inline reference, add a space before it:
+.Bd -literal -offset indent
+\&.Rf Johnson 92 .
+.Ed
+.Pp
+To wrap the inline reference in parentheses, use the following syntax:
+.Bd -literal -offset indent
+\&.Rf Johnson 92 ) (
+.Ed
+.Pp
+Additionally, any instance of
+.Li ''
+is replaced with the last word on the preceding line.
+This allows the following shortcut:
+.Bd -literal -offset indent
+According to Johnson
+\&.Rx '' 92 ,
+there has been a gradual change in attitudes towards ...
+.Ed
+.
.Sh FORMAT SYNTAX
+.Ss Interpolation
In a format definition, use a percent (%)
sigil followed by a single letter to interpolate any given field of the reference.
The letter following the percent sign corresponds to the second letter of the reference list macros described above.
For example:
.Bd -literal -offset indent
-\&.Ff (%a, %y) \\" (Author, Year)
+\&.Ff (%A, %y) \\" (Author, Year)
.Ed
.Pp
By wrapping an interpolation in braces, you can specify a prefix and/or suffix that should be included only if the interpolation is successful.
For example:
.Bd -literal -offset indent
-\&.Ff (%a{, %y}). \\" Here, ', ' is removed if there is no year.
+\&.Ff (%A{, %y}). \\" Here, ', ' is removed if there is no year.
.Ed
.Pp
-You can include a newline in your format by ending the line with a backslash and continuing on the next line.
-If you add a backslash immediately following the macro name, the interpolated format will be joined to the preceding line.
+To interpolate only the
+.Sy surnames
+of the authors, you can use the special
+.Em %A
+syntax, with an uppercase instead of lowercase
+.Sq a .
+.
+.Ss Special backslash behavior
+.Bl -enum
+.It
+A backslash at the end of a format line acts as a line continuation marker.
+The newline after the backslash is preserved.
+.It
+For format macros describing inline references, a backslash immediately following the macro name will cause the reference be joined to the preceding line.
+.El
+.Pp
+Anywhere else in the line, backslashes are preserved literally.
+.Pp
By using backslashes, you can implement footnote-based references.
For example, using the ms macro package:
.Bd -literal -offset indent
\&.Fx\\ \\**\\
\&.FS\\
-%A, {\\fI%t\\fR}, {\\*Q%q\\*U}, %y.\\
+%a, {\\fI%t\\fR}, {\\*Q%q\\*U}, %y.\\
\&.FE
.Ed
+.
+.Ss Automatic cleanup
.Pp
-As you can see above, you can use troff requests and other macros in your format.
-This will expand to a valid request/macro in the output of
-.Nm .
-.Pp
-Note that all fields are inserted literally, with one exception:
-when
-.Em %a
-is used in an inline reference format, the forenames of the authors are automatically removed.
-To include the forenames, use
-.Em %A
-instead.
-.Pp
-Finally, you usually don't need to worry about excessive spaces and stray punctuation marks.
+You usually don't need to worry about excessive spaces and stray punctuation marks.
.Nm
removes common punctuation immediately preceding and following an unsuccessful interpolation.
+Excessive spaces are also removed, unless they follow a period, marking the end of a sentence.
.
.Sh EXAMPLE
Below is an example of an ms-based troff document using
@@ -244,20 +276,20 @@ Literature
\&.Ra Davidson, H.
\&.Ry 1991
\&.Rt Seminal Work
-\&.Rc London
-\&.Rp Another Press
+\&.Rc Athens
+\&.Rp Logos
\&.XP
\&.Ra Smith, P.
\&.Ry 2007
\&.Rt Modern Society
-\&.Rc New York
-\&.Rp Some Press
+\&.Rc Athens
+\&.Rp Logos
.Ed
.Pp
When given the above file,
.Nm
-will output the following code:
+will output the following source code:
.Bd -literal -offset indent
\&.de noop
\&..
@@ -266,6 +298,7 @@ will output the following code:
\&.SH
Previous work
+
\&.LP
Davidson
(1991)
@@ -279,10 +312,10 @@ has performed a study [...]
Literature
\&.XP
-Davidson, H. (1991). \\fISeminal Work\\fR. London: Another Press.
+Davidson, H. (1991). \\fISeminal Work\\fR. Athens: Logos.
\&.XP
-Smith, P. (2007). \\fIModern Society\\fR. New York: Some Press.
+Smith, P. (2007). \\fIModern Society\\fR. Athens: Logos.
.Ed
.
.Sh AUTHORS