Discussion:
Ling-TeX: Non-numeric years in natbib
Andreea Calude
2006-10-25 01:08:51 UTC
Permalink
Hi everyone,

I am working with natbib in MiKTeX and would like to include
references with "in press" or "forthcoming" rather than numerical
values for the YEAR field.

Does anyone how to do this (so I can avoid having references which
say (John, ming) in my chapters)? I am thinking there should be
a nice, simple way to do this, but I can't find any command for it.

Please excuse my ignorance if this is a silly question, I am quite
new to LaTeX.

I would be grateful for any help,

Thanks,

Andreea

PhD student
Department of Applied Language Studies and Linguistics
The University of Auckland
Auckland, New Zealand
Alan Munn
2006-10-25 13:40:52 UTC
Permalink
Post by Andreea Calude
Hi everyone,
I am working with natbib in MiKTeX and would like to include
references with "in press" or "forthcoming" rather than numerical
values for the YEAR field.
Does anyone how to do this (so I can avoid having references which
say (John, ming) in my chapters)? I am thinking there should be
a nice, simple way to do this, but I can't find any command for it.
Please excuse my ignorance if this is a silly question, I am quite
new to LaTeX.
What's wrong with putting "in press" as the year field in your BibTeX
file? So for example:


@article{test2006,
Author = {Some Author},
Journal = {The Linguistics Journal},
Number = {1},
Pages = {1-20},
Title = {Some Article Title},
Volume = {1},
Year = {in press}}


In the latex source, one would cite this with \cite{test2006} and
natbib (with the appropriate .bst file) would produce: "Author (in
press) says ..." while the bibliography will have the following (my
default .bst doesn't have parentheses around the year in the
references.)

Author, Some. in press. Some article title. The Linguistics Journal 1:1-20.

Alan
--
Alan Munn
amunn-mhe/***@public.gmane.org
Department of Linguistics
and Germanic, Slavic, Asian and African Languages Fax. +1-517-432-2736
Michigan State University, East Lansing MI 48824 Tel. +1-517-355-7491
Alan Munn
2006-10-26 18:42:26 UTC
Permalink
Post by Alan Munn
Post by Andreea Calude
Hi everyone,
I am working with natbib in MiKTeX and would like to include
references with "in press" or "forthcoming" rather than numerical
values for the YEAR field.
Does anyone how to do this (so I can avoid having references which
say (John, ming) in my chapters)? I am thinking there should be
a nice, simple way to do this, but I can't find any command for it.
Please excuse my ignorance if this is a silly question, I am quite
new to LaTeX.
What's wrong with putting "in press" as the year field in your
Actually, this turns out to be more of a problem than it looks at
first sight. The truncation of the year is a function of the bst
file you are using. If you use makebst you can create an equivalent
file which doesn't truncate the year (it's one of the options as you
go through the makebst process.)

However, this doesn't solve the problem of multiple forthcomings from
the same author, and will produce 'forthcominga' and 'forthcomingb'
in the references, and 'forthcoming, f' (!) in the citations.

So if you can live without multiple forthcomings by the same author,
the solution will work. If you do have multiple forthcomings, one
clunky, (and certainly not ideal) solution would be to use
\citeauthor in the in-text citations, add the 'forthcoming' manually
and then edit the .bbl file manually at the end to add appropriate
punctuation to the 'a', 'b' etc. in the references. Ugly, but it
will get the job done.

Alan
--
Alan Munn
amunn-mhe/***@public.gmane.org
Department of Linguistics
and Germanic, Slavic, Asian and African Languages Fax. +1-517-432-2736
Michigan State University, East Lansing MI 48824 Tel. +1-517-355-7491
Alexis Dimitriadis
2006-10-26 19:16:35 UTC
Permalink
Certain bibtex styles truncate the "year" to four characters, hence in
Andreea's example "forthcoming" appears as "(John, ming)". This might just
happen to the in-text citations, i really don't recall. And I can't say I
know how to deal with it-- perhaps by enclosing "forthcoming" in an extra
set of braces?

year = "{forthcoming}", or
year = {{forthcoming}}

Alexis



_____

Van: ling-tex-owner-6miFZF/***@public.gmane.org [mailto:ling-tex-owner-6miFZF/***@public.gmane.org] Namens
Alan Munn
Verzonden: Wednesday, October 25, 2006 3:41 PM
Aan: ling-tex-6miFZF/***@public.gmane.org
Onderwerp: Re: Ling-TeX: Non-numeric years in natbib


At 2:08 PM +1300 10/25/06, Andreea Calude wrote:

Hi everyone,

I am working with natbib in MiKTeX and would like to include
references with "in press" or "forthcoming" rather than numerical
values for the YEAR field.

Does anyone how to do this (so I can avoid having references which
say (John, ming) in my chapters)? I am thinking there should be
a nice, simple way to do this, but I can't find any command for it.

Please excuse my ignorance if this is a silly question, I am quite

new to LaTeX.


What's wrong with putting "in press" as the year field in your BibTeX file?
So for example:


@article{test2006,
Author = {Some Author},
Journal = {The Linguistics Journal},
Number = {1},
Pages = {1-20},
Title = {Some Article Title},
Volume = {1},
Year = {in press}}


In the latex source, one would cite this with \cite{test2006} and natbib
(with the appropriate .bst file) would produce: "Author (in press) says ..."
while the bibliography will have the following (my default .bst doesn't have
parentheses around the year in the references.)

Author, Some. in press. Some article title. The Linguistics Journal 1:1-20.

Alan
--
Alan Munn
amunn-mhe/***@public.gmane.org
Department of Linguistics
and Germanic, Slavic, Asian and African Languages Fax. +1-517-432-2736
Michigan State University, East Lansing MI 48824 Tel. +1-517-355-7491
Claire Bowern
2006-10-26 20:39:38 UTC
Permalink
you can define a command that prints forthcoming or in press, etc. That
works with my .bst file:

\newcommand{\inpr}{in press\xspace}

etc.
Claire
Post by Alexis Dimitriadis
Certain bibtex styles truncate the "year" to four characters, hence in
Andreea's example "forthcoming" appears as "(John, ming)". This might
just happen to the in-text citations, i really don't recall. And I can't
say I know how to deal with it-- perhaps by enclosing "forthcoming" in
an extra set of braces?
year = "{forthcoming}", or
year = {{forthcoming}}
Alexis
Alan Munn
2006-10-26 22:28:06 UTC
Permalink
Post by Claire Bowern
you can define a command that prints forthcoming or in press, etc.
\newcommand{\inpr}{in press\xspace}
etc.
Claire
This unfortunately still doesn't solve the multiple forthcomings
problem although it will definitely be less dependent on the bst file
one uses for the simple cases.

(Just so that Andreea understands how this would work, you would put
\inpr (or \forth etc) in the date field of your BiBTeX database and
then add the appropriate number of newcommands to your latex source.
Also, this needs the xspace package to work.)

Alan
--
Alan Munn
amunn-mhe/***@public.gmane.org
Department of Linguistics
and Germanic, Slavic, Asian and African Languages Fax. +1-517-432-2736
Michigan State University, East Lansing MI 48824 Tel. +1-517-355-7491
Axel Herold
2006-10-27 06:41:39 UTC
Permalink
Post by Claire Bowern
\newcommand{\inpr}{in press\xspace}
[...] although it will definitely be less dependent on the bst file one
uses for the simple cases.
It would probably also allow you to use the same bibliography files for
documents written in languages different from English: You would only have
to adjust the \inpr and \forh macro once instead of editing your .bib file
directly. Still, not an ideal solution in this respect as it should work
automatically with language packages such as babel or even with
internationalised .bst files. I think this would require syntactic
elements in the /year/ field (say, /forth/ and /inpr/) that are evaluated
by bibtex (comparable to the /and/ element in /author/ and /editor/).

Best regards,
Axel Herold.
--
[...] er mißtraute den Worten, die sich euphonisch und rhythmisch fügten,
mit dem behaglichen Schnurren, das den Leser hypnotisiert,
nachdem der Schriftsteller als erster ihm zum Opfer gefallen ist.
(Cortázar: Rayuela)
Alan Munn
2006-10-26 22:36:53 UTC
Permalink
Post by Claire Bowern
you can define a command that prints forthcoming or in press, etc.
\newcommand{\inpr}{in press\xspace}
etc.
Claire
Are you sure your .bst file actually truncates years? This solution
yields 'Author (orth)' when my .bst file is set to truncate the year.

Alan
--
Alan Munn
amunn-mhe/***@public.gmane.org
Department of Linguistics
and Germanic, Slavic, Asian and African Languages Fax. +1-517-432-2736
Michigan State University, East Lansing MI 48824 Tel. +1-517-355-7491
Andreea Calude
2006-10-26 22:24:56 UTC
Permalink
Hi everyone,

Many thanks for your quick reply.

I tried putting duoble {}, but that did not seem to solve the problem
unfortunately.

The new command (\newcommand{\inpr}{in press\xspace}) seems like a really
nice and clean way of dealing with
the problem. I was wondering, where should this command go? I tried putting
it at the beginning of the chapter (I
am writing a PhD thesis) which has the references with the "in press", etc.,
but it did not work. I also put it in the
main thesis file which links all the chapters, but that also didn't work.
Where should I have put it?

Thanks again for all your help and ideas,
Regards,
Andreea
Post by Claire Bowern
you can define a command that prints forthcoming or in press, etc. That
\newcommand{\inpr}{in press\xspace}
etc.
Claire
Post by Alexis Dimitriadis
Certain bibtex styles truncate the "year" to four characters, hence in
Andreea's example "forthcoming" appears as "(John, ming)". This might
just happen to the in-text citations, i really don't recall. And I can't
say I know how to deal with it-- perhaps by enclosing "forthcoming" in
an extra set of braces?
year = "{forthcoming}", or
year = {{forthcoming}}
Alexis
Andreea Calude
2006-10-26 22:45:37 UTC
Permalink
My file has: Author (ming), Author (ress) and Author (pear),
seems to just take the last four characters.
Post by Alan Munn
Post by Claire Bowern
you can define a command that prints forthcoming or in press, etc.
\newcommand{\inpr}{in press\xspace}
etc.
Claire
Are you sure your .bst file actually truncates years? This solution
yields 'Author (orth)' when my .bst file is set to truncate the year.
Alan
--
Alan Munn
Department of Linguistics
and Germanic, Slavic, Asian and African Languages Fax. +1-517-432-2736
Michigan State University, East Lansing MI 48824
Tel. +1-517-355-7491
Ron Artstein
2006-10-27 09:40:40 UTC
Permalink
Post by Andreea Calude
I am working with natbib in MiKTeX and would like to include
references with "in press" or "forthcoming" rather than numerical
values for the YEAR field.
Hi everyone,

Sorry for not responding to each of the previous suggestions
individually. You guys are all right about the problem coming from
the bibtex style files (.bst), and about the fact that custom-bib
allows you to choose whether or not to truncate the year field to
four characters, but does not afford the option of separating the
extra label when the year field is not numeric.

The desired effect, e.g. forthcoming(a) and forthcoming(b),
requires direct manipulation of the .bst files. I know of one .bst
file that does this -- the style I had created for submissions to
Natural Language Semantics, to which the forthcoming(a) feature was
added by Uli Sauerland. It's available at:

http://privatewww.essex.ac.uk/~artstein/nals.bst

If this file produces suitable output, go ahead and use it;
otherwise, you'll need to try and hack the desired functionality
into your .bst file, perhaps using this as an example.

Cheers, -Ron.


P.S. For those of you who want to tackle the problem, here are a
few tips which might make your life (marginally) easier.

The desired functionality is found inside FUNCTION {reverse.pass}.

Apparently, what this function does in nals.bst is check if the
*first* character of the year field is 1 or 2. If it is, then
the extra label is appended without parentheses: 1889a, 2006b.
If the first character isn't 1 or 2 then parentheses are added:
in press(a), forthcoming(b).

This means that the function will need to be changed by the next
millennium, as it produces 3002(a) ;-) It's also not appropriate
for citations of very ancient works (before 1000), or citations
of contemporary work using a different calendar system (like the
Jewish calendar, where the current year is 5767). It also messes
up "cute" spellings like "2 appear", which might be considered a
feature :-)

Finally, the year function does truncate all years whose first
character is 1 or 2 to four characters, meaning you can get years
like "forthcoming" or 3001/2, but a citation like Prince and
Smolensky (1993/2004) will get truncated to 1993. The truncation
behavior is an inheritance from klunamed.bst (Kluwer's style file
on which nals.bst is based), and is probably unintended.

When I have the time for it I will incorporate an improved extra
label function into my currently maintained .bst files. Until then,
have fun hacking!

-Ron.
Ron Artstein
2006-10-27 11:29:09 UTC
Permalink
Post by Andreea Calude
I am working with natbib in MiKTeX and would like to include
references with "in press" or "forthcoming" rather than numerical
values for the YEAR field.
Hi Again,

The problem turned out to be less difficult than I thought. I have
now added the forthcoming(a) functionality to the three .bst files
which I maintain:

http://privatewww.essex.ac.uk/~artstein/lingua.bst
http://privatewww.essex.ac.uk/~artstein/compling.bst
http://privatewww.essex.ac.uk/~artstein/LandP.bst

If one of these produces the desired results, just use it. If you
need the output to be formatted differently, the following should
hopefully work -- though only for styles generated by custom-bib.

Start with a .bst file created by custom-bib which does not
truncate years. Open this file in a text editor. Locate the
following function:

FUNCTION {reverse.pass}
{ next.extra "b" =
{ "a" 'extra.label := }
'skip$
if$
extra.label 'next.extra :=
extra.label
duplicate$ empty$
'skip$
{ "{\natexlab{" swap$ * "}}" * }
if$
'extra.label :=
label extra.label * 'label :=
}


Now replace the line { "{\natexlab{" swap$ * "}}" * } with the
following four lines:

{ year field.or.null #-1 #1 substring$ chr.to.int$ #65 <
{ "{\natexlab{" swap$ * "}}" * }
{ "{(\natexlab{" swap$ * "})}" * }
if$ }

Save, and you're done!


Explanation: the first line in the above snippet checks the ASCII
code of the final character in the year field. If it's less than 65
(which is the code for uppercase A), it simply adds an extra label.
Otherwise it adds the extra label in parentheses. The result is
that any year field ending in an uppercase or lowercase letter will
have the extra label appended in parentheses, whereas a year field
ending in a number will have the extra label appended without
parentheses. I don't expect we should care about year fields that
end in a non-alphanumeric characrter; most of these will get an
extra label without parentheses, though some will get parentheses
(those that end in [\]^_`{|}~, which have ASCII codes above A).

-Ron.
Alan Munn
2006-10-27 12:11:26 UTC
Permalink
Post by Ron Artstein
Post by Andreea Calude
I am working with natbib in MiKTeX and would like to include
references with "in press" or "forthcoming" rather than numerical
values for the YEAR field.
[snip]
Post by Ron Artstein
Start with a .bst file created by custom-bib which does not
truncate years. Open this file in a text editor. Locate the
FUNCTION {reverse.pass}
{ next.extra "b" =
{ "a" 'extra.label := }
'skip$
if$
extra.label 'next.extra :=
extra.label
duplicate$ empty$
'skip$
{ "{\natexlab{" swap$ * "}}" * }
if$
'extra.label :=
label extra.label * 'label :=
}
Now replace the line { "{\natexlab{" swap$ * "}}" * } with the
{ year field.or.null #-1 #1 substring$ chr.to.int$ #65 <
{ "{\natexlab{" swap$ * "}}" * }
{ "{(\natexlab{" swap$ * "})}" * }
if$ }
Save, and you're done!
Thanks a lot Ron. This works perfectly. The only thing that doesn't
work is citations in the text of the sort where the same author is
repeated. e.g. \cite{a1,a2) where a1 and a2 are both non-numeric.
In this case the first reference comes out right but only the first
character of the second appears. (e.g. 'Author (forthcoming, f)' But
this must be a problem with natbib, not the .bst file I think.

There's been an identical discussion ongoing in comp.text.tex. Can I
post your solution there, too?

Alan
--
Alan Munn
amunn-mhe/***@public.gmane.org
Department of Linguistics
and Germanic, Slavic, Asian and African Languages Fax. +1-517-432-2736
Michigan State University, East Lansing MI 48824 Tel. +1-517-355-7491
Ron Artstein
2006-10-27 12:45:48 UTC
Permalink
Post by Alan Munn
Thanks a lot Ron. This works perfectly. The only thing that
doesn't work is citations in the text of the sort where the same
author is repeated. e.g. \cite{a1,a2) where a1 and a2 are both
non-numeric. In this case the first reference comes out right but
only the first character of the second appears. (e.g. 'Author
(forthcoming, f)' But this must be a problem with natbib, not the
.bst file I think.
I don't know. It might be a problem with natbib, or an interaction
between natbib and the .bst file. But this bug is independent of
the parentheses-adding code: it also surfaces with .bst files
generated by custom-bib without modification. So it should be
considered a bug in the natbib/custom-bib packages.
Post by Alan Munn
There's been an identical discussion ongoing in comp.text.tex.
Can I post your solution there, too?
Absolutely -- with the above note. Maybe it will find its way to
the maintainers of natbib/custom-bib.

-Ron.
Ron Artstein
2006-10-27 13:40:16 UTC
Permalink
Post by Alan Munn
In this case the first reference comes out right but
only the first character of the second appears. (e.g.
'Author (forthcoming, f)'
[SNIP]
But this bug is independent of the parentheses-adding code: it
also surfaces with .bst files generated by custom-bib without
modification. So it should be considered a bug in the
natbib/custom-bib packages.
Let me qualify this statement. Natbib knows how to parse
\bibitem[Author(2002a)] and \bibitem[Author(2002b)] to output
Author (2002a,b). Here are some clues as to how this works:

\bibitem[Author(in press(a))] and \bibitem[Author(in press(b))]
produce Author (in press(a),i).

\bibitem[Author(in pressa)] and \bibitem[Author(in pressb)]
produce Author (in pressa,i).

\bibitem[Author(1993/2004a)] and \bibitem[Author(1993/2004b))]
produce Author (1993/2004a,/).

\bibitem[Author(1993-4)] and \bibitem[Author(1993/2004))]
produce Author (1993-4,/).

\bibitem[Author(1993-4)] and \bibitem[Author(19932))]
produce Author (1993-4,2).

\bibitem[Author(199//a)] and \bibitem[Author(199//b))]
produce Author (199//a,/).

\bibitem[Author(199aa)] and \bibitem[Author(199ab))]
produce Author (199aa,a).

\bibitem[Author(199aa)] and \bibitem[Author(199a))]
produce Author (199aa,a).

\bibitem[Author(1993-4)] and \bibitem[Author(1993))] give
Package natbib Warning: Multiple citation on page 1: same authors and year
(natbib) without distinguishing extra letter,
(natbib) appears as question mark.

So here's what happens, I guess: natbib compares the first four
characters of the year field in order to decide if two citations
are from the same year. If the first four characters are identical
it prints the full year of the first citation, a comma, and one
character from the year of the second citation which is taken to be
the extra label: this is the first letter or the fifth character,
whichever comes first. If the second citation only contains four
non-letter characters, natbib complains that the year fields are
identical (even if the first year field does have additional
characters).

I guess a better algorithm would parse each year field into a year
designator and an extra label, compare the full year designators,
and if they're identical print the year designator and the two
extra labels, taking account of parentheses to get "in press(a,b)".
This sound like very heavy natbib hacking to me, and I'm not going
to even try it.

-Ron.
Andreea Calude
2006-10-30 02:56:16 UTC
Permalink
Many thanks for everyone who responded to my e-mail.

Unfortunately, I am not an expert when it comes to designing my own .bst
files and I have decided to get around the problem by "brute force"
(a very shameful solution indeed, but that's how it goes), which is to force
citations into the bibliography by using the \nocite{} command, and manually
write in the actual "Author (forthcoming)" bits and so on. As it happens, I
only have 4 references of this type, so it's not too much of a bother.

Still, at least I know there is no easy answer to my question,
Thanks again for your efforts and time,

Regards,

Andreea
Post by Ron Artstein
Post by Alan Munn
In this case the first reference comes out right but
only the first character of the second appears. (e.g.
'Author (forthcoming, f)'
[SNIP]
But this bug is independent of the parentheses-adding code: it
also surfaces with .bst files generated by custom-bib without
modification. So it should be considered a bug in the
natbib/custom-bib packages.
Let me qualify this statement. Natbib knows how to parse
\bibitem[Author(2002a)] and \bibitem[Author(2002b)] to output
\bibitem[Author(in press(a))] and \bibitem[Author(in press(b))]
produce Author (in press(a),i).
\bibitem[Author(in pressa)] and \bibitem[Author(in pressb)]
produce Author (in pressa,i).
\bibitem[Author(1993/2004a)] and \bibitem[Author(1993/2004b))]
produce Author (1993/2004a,/).
\bibitem[Author(1993-4)] and \bibitem[Author(1993/2004))]
produce Author (1993-4,/).
\bibitem[Author(1993-4)] and \bibitem[Author(19932))]
produce Author (1993-4,2).
\bibitem[Author(199//a)] and \bibitem[Author(199//b))]
produce Author (199//a,/).
\bibitem[Author(199aa)] and \bibitem[Author(199ab))]
produce Author (199aa,a).
\bibitem[Author(199aa)] and \bibitem[Author(199a))]
produce Author (199aa,a).
\bibitem[Author(1993-4)] and \bibitem[Author(1993))] give
Package natbib Warning: Multiple citation on page 1: same authors and year
(natbib) without distinguishing extra letter,
(natbib) appears as question mark.
So here's what happens, I guess: natbib compares the first four
characters of the year field in order to decide if two citations
are from the same year. If the first four characters are identical
it prints the full year of the first citation, a comma, and one
character from the year of the second citation which is taken to be
the extra label: this is the first letter or the fifth character,
whichever comes first. If the second citation only contains four
non-letter characters, natbib complains that the year fields are
identical (even if the first year field does have additional
characters).
I guess a better algorithm would parse each year field into a year
designator and an extra label, compare the full year designators,
and if they're identical print the year designator and the two
extra labels, taking account of parentheses to get "in press(a,b)".
This sound like very heavy natbib hacking to me, and I'm not going
to even try it.
-Ron.
Loading...