1

I use natbib with apalike and find that the citation with no date shows (in the text): Ulzheimer (nd) explains why one’s credit scores differ across the three credit bureaus.

But in the reference list, it shows: Ulzheimer, J. (n.d.). Why do my credit scores differ across the credit bureaus? Experian, https://tinyurl.com/h2p9u6ss. Accessed: 2021-3-8.

Is there any way to make it show as Ulzheimer (n.d.) in the text too?

Here's the code:

@misc{experiancs,
Author={Ulzheimer, John},
  title = {Why do my credit scores differ across the credit bureaus?},
  howpublished = {Experian, https://tinyurl.com/h2p9u6ss},
     publisher={Experian},
       year={{n.d.}},
         note = {Accessed: 2021-3-8}
}

I've tried leaving the year empty and for some reason, the author-year citations became numbered citations.

Alan Munn
  • 218,180
  • Welcome to TeX.SE! Please -- as usual here -- show us a short tex code resulting in your issue. Then we do not have to guess what you are doing ... – Mensch May 15 '21 at 16:11
  • Hi! Using this code will result in changing the author-citations to numbered citations. @misc{experiancs, Author={Ulzheimer, John}, title = {Why do my credit scores differ across the credit bureaus?}, howpublished = {Experian, https://tinyurl.com/h2p9u6ss}, publisher={Experian}, year={}, note = {Accessed: 2021-3-8} } – user242219 May 15 '21 at 16:15
  • @user242219 The .bib file entry doesn't really show the problem. We need to see a minimal .tex document that shows how you are creating the bibliography. – Alan Munn May 15 '21 at 16:48
  • @Mensch I use the following code: \citet{experiancs} explains why one's credit scores differ across the three credit bureaus. \bibliographystyle{apalike} \bibliography{bibliography}{} – user242219 May 15 '21 at 16:58

1 Answers1

1

The apalike.bst file strips non-alphanumeric characters from the citation labels. If you want to have n.d. in the citation callout, you need to make a copy of the apalike.bst and modify it in the following way:

On line 896 you should find the function {calc.label}:

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 purify$ #-1 #4 substring$          % uses all four digits
  *
  'label :=
}

On line 909, remove the purify$ command, which is responsible for removing the non-alphanumeric characters. Your new function should look like this:

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 :=
}

Save this copy with a new name, e.g. apalike-impure.bst. Now your citation callouts will show up exactly as they appear in the year field in the .bib file.

\documentclass{article}
\begin{filecontents}[overwrite]{\jobname.bib}
@misc{experiancs,
Author={Ulzheimer, John},
  title = {Why do my credit scores differ across the credit bureaus?},
  howpublished = {Experian, https://tinyurl.com/h2p9u6ss},
     publisher={Experian},
       year={n.d.},
         note = {Accessed: 2021-3-8}
}
\end{filecontents}
\usepackage{natbib}
\bibliographystyle{apalike-impure}
\begin{document}
\citet{experiancs}
\bibliography{\jobname}
\end{document}

output of code

Alan Munn
  • 218,180
  • It really worked! Thank you so much! – user242219 May 15 '21 at 17:27
  • 1
    @user242219 If this solved your problem, it's helpful to "accept" it by clicking on the green checkmark next to the answer. And for future questions, it's also helpful (and many times absolutely necessary) to include a small compilable document (like the one in my answer) that shows the problem you're having. – Alan Munn May 15 '21 at 17:30