Skip to content

Commit 6971b5d

Browse files
author
smeyer
committed
tweak r89393 and update bibcite description
git-svn-id: https://svn.r-project.org/R/trunk@89702 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e99882f commit 6971b5d

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

doc/manual/R-exts.texi

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8708,9 +8708,9 @@ UTF-8 in @LaTeX{} is quite low.
87088708
@node Bibliographic citations and references
87098709
@section Bibliographic citations and references
87108710

8711-
For R at least 4.6.0 one can auto-generate bibliographic citations and
8711+
For @R{} at least 4.6.0 one can auto-generate bibliographic citations and
87128712
references from bibentries in bibliographic databases in R or Bib@TeX{}
8713-
formats. This is implemented via build stage @code{\Sexpr} macros
8713+
formats. This is implemented via build-stage @code{\Sexpr} macros
87148714
(@pxref{Dynamic pages}) in the file @file{share/Rd/macros/system.Rd} of
87158715
the @R{} source or home directory. For @HTML{} output, the citations
87168716
are conveniently hyperlinked to the corresponding references.
@@ -8719,24 +8719,25 @@ Textual and parenthetical citations are obtained via, respectively,
87198719
@code{\bibcitet} and @code{\bibcitep} (the naming follows that of
87208720
@code{\citet} and @code{\citep} in the @LaTeX{} @code{natbib} package
87218721
(@uref{https://mirrors.ctan.org/macros/latex/contrib/natbib, Daly
8722-
2010}). These macros both take a comma separated @var{citespec} list as
8723-
argument, where a @var{citespec} can be a @var{keyspec} or of the form
8722+
2010}). These single-argument macros both take either a comma-separated
8723+
list of one or more @var{keyspec}s or a single @var{citespec} of the form
87248724
@code{@var{before}|@var{keyspec}|@var{after}} with both @samp{|}
87258725
mandatory and @var{before} and @var{after} possibly empty text to be
8726-
inserted before and after the citation if not empty. If these texts
8727-
contain commas, these can be backslash-escaped: see the examples below.
8726+
inserted before and after the citation if not empty.
87288727

87298728
A @var{keyspec} is either a simple @var{key} or of the form
8730-
@code{@var{pkg}::@var{key}}. In the former case, @var{key} is taken as
8731-
the key of a bibentry in R's system bibentry data base (available via
8732-
the currently unexported @code{tools:::R_bibentries()} with sources in
8733-
the @file{.R} files in the @file{share/bibentries} directory of the R
8734-
sources). In the latter case, @var{key} is looked up in the bibentry
8729+
@code{@var{pkg}::@var{key}}.
8730+
In the latter case, @var{key} is looked up in the bibentry
87358731
data base of package @var{pkg}, made available in the packages sources
87368732
either as @file{inst/REFERENCES.R} in R format (an R code file encoded
87378733
in UTF-8 with calls to @code{bibentry()}, as for the
87388734
@file{inst/CITATION} file) or as @file{inst/REFERENCES.bib} in Bib@TeX{}
87398735
format (this needs @CRANpkg{bibtex} to be installed).
8736+
A simple @var{key} without a @var{pkg} prefix is taken as the key of a
8737+
``local'' bibentry (from the package containing the Rd file) or of R's
8738+
system bibentry data base (available via the currently unexported
8739+
@code{tools:::R_bibentries()}, with sources in R's
8740+
@file{share/bibliographies} directory).
87408741

87418742
References (usually in the @code{\references} section) are obtained via
87428743
@code{\bibshow}, which takes a comma-separated @var{keyspec} list as
@@ -8761,11 +8762,11 @@ For example,
87618762
gives a textual citation of the ``@emph{Blue Book}''
87628763
(`@I{Becker, Chambers, and Wilks (1988)}' when first encountered),
87638764
@example
8764-
\bibcitep@{e.g.\,|R:Chambers+Hastie:1992|page 123@}
8765+
\bibcitep@{|R:Chambers+Hastie:1992|page 123@}
87658766
@end example
87668767
@noindent
87678768
gives a parenthetical citation of a page in the ``@emph{White Book}''
8768-
(`@I{(e.g., Chambers and Hastie 1992, page 123)}' when first encountered).
8769+
(`@I{(Chambers and Hastie 1992, page 123)}' when first encountered).
87698770
An Rd file having cited the above two and also wanting to include the
87708771
``@emph{Green Book}'' in its references could use
87718772
@example
@@ -8802,7 +8803,7 @@ disambiguate by manually adding the suffixes to the year fields, e.g.
88028803

88038804
As these macros are evaluated at build stage, packages using these and
88048805
built with R >= 4.6.0 can be used without problems for R < 4.6.0.
8805-
(However, checking such packages with R < 4.6.0 will warn that these
8806+
(However, checking such packages with R < 4.5.3 will warn that these
88068807
macros are unknown.)
88078808

88088809
@node Processing documentation files

src/library/tools/R/bibtools.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ function(keys)
6262
pkg <- if(length(dir)) {
6363
basename(dir[1L])
6464
} else character()
65-
c(R_bibentries(),
66-
.bibentries_from_REFERENCES(dir, pkg))
65+
c(.bibentries_from_REFERENCES(dir, pkg),
66+
R_bibentries())
6767
} else NULL
6868
if(!any(ind)) {
6969
## Special-case for efficiency.

0 commit comments

Comments
 (0)