Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need to cite a work from antiquity that has no known date, using natbib and author-year citations. The best suggestion I've found is to write the citation using "n.d." (no date) for the year of publication, but putting that into by bibtex file renders an ugly citation without periods:

(Author nd)

when what I'd like is:

(Author n.d.)

Wrapping it in curly braces ("{n.d.}") doesn't seem to help with the in-line citation (though it works in the bibliography).

How can I force BibTex to render the date in an in-line citation with punctuation?


Example .bib

@book{aristotle,
    Author = {Aristotle},
    Booktitle = {Works of Aristotle},
    Title = {Categoriae},
    Year = {{n.d.}}}

Example LaTeX

\documentclass{article}

\usepackage[authoryear]{natbib}
\bibliographystyle{apalike}

\begin{document}
Lorem ipsum dolor sit amet \citep{aristotle}, consectetur adipiscing elit.

\bibliography{file.bib}
\end{document}

(Ugly, incorrect) output

Lorem ipsum dolor (Aristotle, nd) sit amet.

REFERENCES
Aristotle (n.d.). Categoriae.
share|improve this question
1  
It seems that apalike.bst strips everything from the contents of the year field except for the last up to four letters or digits. The culprit is the function calc.label; if the call to purify$ is removed, then n.d. is accepted (as it consists of four characters). –  egreg Jul 19 '12 at 15:18
add comment

1 Answer

up vote 8 down vote accepted

The function calc.label in apalike.bst is responsible of this: it strips away all non alphanumeric characters and keeps the last up to four characters remaining.

If you copy apalike.bst to myapalike.bst and change the function defined in lines 896-912 to become

FUNCTION {calc.label}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.label                       % apalike ignores organization
        'author.key.label                       % for labeling and sorting
      if$
    }
  if$
  ", "                                                  % these three lines are
  *                                                     % for apalike, which
  year field.or.null #-1 #4 substring$          % uses all four digits
  *
  'label :=
}

then \bibliographystyle{myapalike} will accept year={n.d.} as you wish: it consists of four characters, after all!

The change consists simply in removing the string purify$. I can't say if this may have adverse effects on other entries; but, as long as you have only years or n.d., all should go well.

share|improve this answer
    
Ah, excellent. That feels like a bit of a hack, but it definitely gets the job done. Thanks! –  Doches Jul 19 '12 at 19:30
1  
@Doches You should consider switching to biblatex. –  egreg Jul 19 '12 at 19:42
    
I'm definitely getting that impression -- but I'm mid-thesis, and right now what I'm using is working. Mostly. And wrangling with LaTeX, while kind of fun in a what-the-fuck-debugging-time way, won't actually get this PhD written any faster... Next piece of LaTeX writing, though? Definitely. –  Doches Jul 20 '12 at 11:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.