[net.text] Citations with "bib"

tjb@dciem.UUCP (Tim Bowden) (11/05/86)

A friend has encountered a problem in using "bib" to prepare
an article to be submitted to a journal.  The journal requires
citations in the text to be one of two forms, depending on the context.
One is a running citation, in which the authors' names
are included in the text and followed by the date in parentheses, e. g.

"...results have been confirmed by Smith and Jones (1982)."

and the other, used where the citation is not part of
the text, has both authors' names and date included in
the parentheses, e. g.

"...results have been confirmed by others (Smith and Jones, 1982)."

How does one set up the bmac.* and bib.* files
so that both types of references can be handled automatically by "bib"
and "troff"?

  "bib" provides for standard and alternative formats for citations,
which might be used for this purpose, but my friend and I, who
have both wrestled with templates and troff macros, cannot see
a way to implement this.

   In particular, it seems necessary for "bib" to alter the [F string
depending on whether a standard or alternative citation
format is used, or to create a string that invokes a conditional
troff instruction to put either an open parenthesis or a comma
between the authors' names and the date, depending on which
form was used.

  We would appreciate it if anyone who has solved this problem
would send me a solution in the form of a bib template or bmac macro
or general advice. The journal is "Human Factors".
-- 

 				Timothy Bowden, DCIEM
       linus!cbosgd!utcs!utcsri!dciem!tjb
or     allegra!cbosgd!utcs!utcsri!dciem!tjb

bates@stat.wisc.edu (Douglas M. Bates) (11/09/86)

> A friend has encountered a problem in using "bib" to prepare
> an article to be submitted to a journal.  The journal requires
> citations in the text to be one of two forms, depending on the context.
> One is a running citation, in which the authors' names
> are included in the text and followed by the date in parentheses, e. g.
> 
> "...results have been confirmed by Smith and Jones (1982)."
> 
> and the other, used where the citation is not part of
> the text, has both authors' names and date included in
> the parentheses, e. g.
> 
> "...results have been confirmed by others (Smith and Jones, 1982)."
> 
> How does one set up the bmac.* and bib.* files
> so that both types of references can be handled automatically by "bib"
> and "troff"?

The reference style you describe is called the Harvard name-date style
and is widely used in statistics journals. We incorporated the style
with "bib" by putting in strings %%%b%%% and %%%e%%% for
`begin-citation' and `end-citation' then filtering the "bib" output
through "sed" before going into "troff". The "sed" script converts the
%%%b%%%'s etc. into strings b1 or b2 depending on the citation type.
Our template for the American Statistical Association style includes
#
#	ASA Style.
#	Should be followed by a sed script to change the %%% strings
#	to calls to the b[12] and e[12] strings.
#
A AR
C 3<%%%b%%%>D<%%%e%%%>
E A
S AD
U
#
I BMACLIB/bibinc.asa
I BMACLIB/bmac.asa
and the bmac.asa file defines strings
.ds b1 , \&
.ds b2 \& (
.ds e1
.ds e2 )
The sed commands which convert the %%%b%%%'s etc. are
/^\.ds \[F.*%%%\([a-z]\)$/s//.ds [M \1/
/%%%e%%%\([a-z]\)/s//\1%%%e%%%/g
/\\\*(\[\[/s/%%%b%%%/\\\*(b1/g
/\\\*(\[\[/s/%%%e%%%/\\\*(e1/g
/\\\*(\[{/s/%%%b%%%/\\\*(b2/g
/\\\*(\[{/s/%%%e%%%/\\\*(e2/g

This has worked quite well for us for a couple of years now. The known
bug in the approach is that putting one citation of each type on
the same line will result in the second one getting the wrong style in
the output. (As best as I can remember, that what happens - I just
know never to do it).