[Tex/LaTex] Slash in year field in author-year citations using “apalike” bibliography style

bibtexnatbib

I use the natbib package (with the default authoryear option) and the apalike bibliography style for bibliographies.

I would like to cite the following bibtex entry:

@article{Lake2010/11,
Author = {Lake, David A.},
Journal = {International Security},
Number = {3},
Pages = {7-52},
Title = {Two Cheers for Bargaining Theory: Assessing Rationalist Explanations of the Iraq War},
Volume = {35},
Year = {2010/11}}

When I use \citep{Lake2010/11} I get the right output in my bibliography

Lake, David A. (2010/11), Two Cheers for Bargaining Theory: Assessing Rationalist Explanations of the Iraq War, International Security, 35(3), 7–52.

However, the citation callout in the text is wrong: (Lake, 1011) instead of (Lake, 2010/11)

The problem seems to be the truncation of the year. So I changed the following line

year field.or.null purify$ #-1 #4 substring$

to

year field.or.null purify$ #-1 #14 substring$

Now I get the following output in the text: (Lake, 201011) — the slash (/) is missing.

Why?

Best Answer

Assuming you have no truly odd characters in the year field, i.e., if the field contains just digits and the occasional / ("slash") character, it suffices to change the line

year field.or.null purify$ #-1 #4 substring$

in the file apalike.bst to

year field.or.null #-1 #14 substring$

Actually, you should make this change to a copy of the file apalike.bst; don't edit an original file of the TeX distribution directly.

The main change is the elimination of the BibTeX built-in function purify$. (As you can probably guess, the function purify$ purges all non-numeric characters from the field. In the present case, this turns out to be too much of a good thing.)

Save the file myapalike.bst (or whatever you may have called the file) either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you select the second method, be sure to update the filename database of your TeX distribution appropriately.

Here's the result of a full MWE. (Note that you should encase "Iraq War" in an extra pair of curly braces, to prevent BibTeX from lowercasing the letters "I" and "W".)

enter image description here

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{Lake201011,
Author = {Lake, David A.},
Journal = {International Security},
Number = {3},
Pages = {7-52},
Title = {Two Cheers for Bargaining Theory: Assessing Rationalist Explanations of the {Iraq War}},
Volume = {35},
Year = {2010/11},
}
\end{filecontents*}
\usepackage{natbib}
\bibliographystyle{myapalike}
\begin{document}
\citep{Lake201011}
\bibliography{\jobname}
\end{document}
Related Question