Rendering of bibentry
objects may be done using routines
modelled after those used by BibTeX. This function allows environments
to be created and manipulated to contain those routines.
There are two ways to create a new style environment. The easiest
is to set .init = TRUE
, in which case the environment will be
initialized with a copy of the default "JSS"
environment. (This style
is modelled after the jss.bst
style used by the Journal
of Statistical Software.) Alternatively, the envir
argument
can be used to specify a completely new style environment.
To find the name of the default style, use getBibstyle()
. To
retrieve an existing style without setting it as the default, use
bibstyle(style, .default = FALSE)
. To modify an existing style,
specify style
and some named entries via ...
.
(Modifying the default "JSS"
style is discouraged.) Setting
style
to NULL
or leaving it missing will retrieve the
default style, but modifications will not be allowed.
At a minimum, the environment should contain routines to render each
of the 12 types of bibliographic entry supported by
bibentry
as well as several other routines
described below.
The former must be named formatArticle
,
formatBook
, formatInbook
, formatIncollection
,
formatInProceedings
, formatManual
,
formatMastersthesis
, formatMisc
, formatPhdthesis
,
formatProceedings
, formatTechreport
and
formatUnpublished
. Each of these takes one argument, a single
unclass
'ed entry from the bibentry
vector
passed to the renderer, and should produce a single element character
vector (possibly containing newlines).
The other routines are as follows. sortKeys
, a function to
produce a sort key to sort the entries, is passed the original
bibentry
vector and should produce a sortable vector of
the same length to define the sort order. Finally,
the optional function cite
should have the same argument list
as utils::cite
, and should produce a citation to be used
in text.
The format
method for "bibentry"
objects adds a
field named ".index"
to each entry after sorting and before
formatting. This is a 1-based index within the complete object that
can be used in styles that require numbering. Although the
"JSS"
style doesn't use numbers, it includes a
fmtPrefix()
stub function that may be used to display them.
See the example below.