1

I'm using BibTeX to cite the references in my LaTeX file. I have one entry (citing an url using the entrytype @misc). The default style is the author-year mode using the apalike style.

This is the entry \cite{url-1}.

The expected output is

This is the entry [url-1].

But, I get the output as

This is the entry [url-1, ].

The BibTeX entry does not have year field. This is

@misc{url-1,
key={url-1},
url={some website},
}

How do I eliminate the extra spacing for the year field. Even if I add an empty field for year like year={}, I still get the same format.

  • BTW: are you getting any warnings from bibtex? See the .blg file? It may be that for apalike year is actually expected, even for misc fields. – daleif Nov 18 '14 at 11:38
  • Do you use a citation management package such as natbib? – Mico Nov 18 '14 at 11:39
  • @daleif, I am getting warnings about missed year in misc fields – kris Nov 18 '14 at 12:47
  • @Mico, I am not using natbib package. – kris Nov 18 '14 at 12:47
1

Since the apalike bibliography style is meant to generate authoryear-style citation callouts, the designer of the style file apparently didn't anticipate that there would be entries (of type @misc, say) that do not have a year field.

Here's a simple work-around: Load the natbib package, and use that package's instruction

\citeauthor{url-1}

instead of \cite{url-1}. As you can probably guess, \citeauthor outputs just the author(s), but not the year.

  • I have tried this option. It works fine but it overrides the other citations. All turned into numeric, rather than author-year format. – kris Nov 19 '14 at 11:09
0

You could use biblatex-apa and its online entry type. If there is no year, it adds (n.d.) (no date) after the title, but that can be removed with a small patch if you don't want it.

 \documentclass{article}
\usepackage[style=apa]{biblatex}
\usepackage[american]{babel}
\DeclareLanguageMapping{american}{american-apa}
\usepackage{filecontents}%
\begin{filecontents*}{online.bib}
@online{Lear,
title ={Edward Lear Home Page},
url = {http://www.nonsenselit.org/Lear/}
}
\end{filecontents*}

\addbibresource{online.bib}

\begin{document}

\cite{Lear}

\printbibliography
\end{document} 

enter image description here

0

I finally managed to get a solution for this. I used a slightly modified .bst file "apalike-url" instead of "apalike" as mentioned here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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