Capitalization and BibTeX

A BibTeX entry is a series of key-value pairs:

@INPROCEEDINGS{KesslerKlingerKuhn2015,
   author = {Kessler, Wiltrud and Klinger, Roman and Kuhn, Jonas},
   title = {{Towards Opinion Mining from Reviews for the 
      Prediction of Product Rankings}},
   booktitle = "Proceedings of the 6th Workshop on Computational 
      Approaches to Subjectivity, Sentiment and Social Media 
      Analysis (WASSA 2015)",
   year = 2015,
}

As we see, the values can be enclosed in quotation marks (booktitle), single curly braces (author), double curly braces (title) or nothing (year). What is the difference?

  • Nothing: can only be used with an integer value afterwards, e.g., a year.
  • Quotation marks "...": Special words like ‘and’ in an author/editor field are processed, capitalization is done according to the bibstyle rules (e.g., all caps, all lowercase, …).
  • Single curly braces {...}: Roughly equivalent to quotation marks.
  • Double curly braces {{...}}: No special words are processed, capitalization is preserved exactly as given.

The exact results will always depend on your bibliography style. Let’s assume we use apalike and natbib. This particular style abbreviates author’s first names, lowercases titles and preserves the exact capitalization of booktitles/conferences. So the above bibtex entry will result in the citation key (Kessler et al., 2015) and the following bibliography listing:

Kessler, W., Klinger, R., and Kuhn, J. (2015). Towards Opinion Mining from Reviews for the Prediction of Product Rankings. In Proceedings of the 6th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis (WASSA 2015).

If we were to use single braces or quotation marks around the title instead of double braces, we’d get the citation key (Kessler et al., 2015) and the bibliography entry

Kessler, W., Klinger, R., and Kuhn, J. (2015). Towards opinion mining from reviews for the prediction of product rankings. In Proceedings of the 6th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis (WASSA 2015).

If we were to use double braces around the author instead of single braces, we’d get the citation key (Kessler, Wiltrud and Klinger, Roman and Kuhn, Jonas, 2015) and the bibliography entry

Kessler, Wiltrud and Klinger, Roman and Kuhn, Jonas (2015). Towards opinion mining from reviews for the prediction of product rankings. In Proceedings of the 6th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis (WASSA 2015).

So clearly you should never ever use double braces around the author. What about titles? Especially when you have abbreviations or non-English titles it may seem a good idea to use double brackets. But be aware that you essentially disable BibTeX’s normalization of capitalization throughout the bibliography. So if at some point in the future you decide/are forced to use a different style that uses different capitalization rules for the titles, you are screwed.

What is the alternative to get correct capitalization in titles without using double braces? Enclose only the letter that should be capitalized in extra braces. For example if we want to capitalize "Opinion Mining" in the title (just because… no real reason) and be sure that "WASSA" is always all caps, we could do this:

@INPROCEEDINGS{KesslerKlingerKuhn2015,
   author = {Kessler, Wiltrud and Klinger, Roman and Kuhn, Jonas},
   title = {Towards {O}pinion {M}ining from Reviews for the 
      Prediction of Product Rankings},
   booktitle = "Proceedings of the 6th Workshop on Computational 
      Approaches to Subjectivity, Sentiment and Social Media 
      Analysis ({WASSA} 2015)",
   year = 2015,
}

And get (Kessler et al., 2015) with:

Kessler, W., Klinger, R., and Kuhn, J. (2015). Towards Opinion Mining from reviews for the prediction of product rankings. In Proceedings of the 6th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis (WASSA 2015).

And even for a style that lowercases the booktitle/conference (for whatever strange reason):

Kessler, W., Klinger, R., and Kuhn, J. (2015). Towards Opinion Mining from reviews for the prediction of product rankings. In proceedings of the 6th workshop on computational approaches to subjectivity, sentiment and social media analysis (WASSA 2015).

Bibentry and duplicate identifiers

I have previously written about listing your publications before the bibliography. This works fine, but there is one problem in combination with document-internal links: An anchor is created at the point where you insert the bibentry. This means that if you click on a citation in the text, you will skip to this location instead of the literature list in the end of the work. Also, you will get errors like this:

l.258 ...a and Blubb, 2014]{BlaBlubb2014}
pdfTeX warning (ext4): destination with the same identifier 
(name{cite.BlaBlubb2014}) has been already used, duplicate ignored

The solution is pretty simple, wrap your bibentry-list in a NoHyper environment (HT J-P’s answer at stackexchange):

\begin{NoHyper}\bibentry{BlaBlubb2014}\end{NoHyper}

List your publications before the bibliography

Usually, in academic texts you cite stuff and at the end there is the bibliography that contains the full entries for all things referenced in the text. But there are some situations where you want to list some complete bibliography entries beforehand, somewhere in the text. For example you may want a list of prior work somewhere near the beginning of a grant proposal or a list of things published during the grant period somewhere at the end, but separate from the bibliography. Of course, you can write this list by hand, but where would be the fun in that?

And of course there is a LaTeX package for that, bibentry. You include the package with your bibliography style in the preamble. You can include it together with natbib.

\bibliographystyle{apalike} % or any other style you like
\usepackage{natbib} % optional, but combination is possible
\usepackage{bibentry}

Then, also in the preamble, you "turn off" the regular bibliography with \nobibliography. After that you can create your list of stuff somewhere in the document, but you will not have a bibliography at the end. Which is probably not what you want. So to additionally be able to include the references in the usual way, use this snippet:

\nobibliography*
\let\oldthebibliography=\thebibliography
\let\endoldthebibliography=\endthebibliography
\renewenvironment{thebibliography}[1]{%
   \begin{oldthebibliography}{#1}%
   \setlength{\parskip}{0ex}%
   \setlength{\itemsep}{0ex}%
}%
{%
   \end{oldthebibliography}%
}

The citing commands (\cite, \citep, etc.) and what they produce are unchanged, but now you can use \bibentry at any point in the text to create the full bibliographic entry. The formatting will be the same as for the references in the bibliography:

Parts of this work have been published in: \bibentry{Kessler2014}

LaTeX citations as used in the NLP community

If you read NLP literature, you will find literature refernces of the form “The first work on this task was done by Smith and Miller (2006). Similar techniques are used in information retrieval (Doe and Norman, 2010).”

This is quite different from what LaTeX usually provides – numbered citations like [1] with ‘plain’ or cryptic letter-number combinations like [SM06] with ‘alpha’. The closest you can get out of the box is ‘apalike’ which would give you [Smith and Miller, 2006].

So what to do?

1. Option: Use a bibliography style provided by some NLP conference, e.g., from NAACL 2013. They will generally offer \newcite to get Smith and Miller (2006) and \cite to get (Doe and Norman, 2010).

2. Option: Use natbib which offers \cite to get Smith and Miller (2006) and \citep to get (Doe and Norman, 2010). Additionally, natbib can do much more, e.g., you can add text into the parenthesis.

Minimal example:

\documentclass[a4paper]{scrartcl}
\usepackage{natbib}
\bibliographystyle{apalike}
\begin{document}
The first work on this task was done by \cite{SmithMiller2006}.
Similar techniques are used in information retrieval \citep{DoeNorman2010}.
\bibliography{literatur}
\end{document}

So, why not use both, some aclstyle and natbib together? Well… they are not compatible (or at least I was not able to make it work).

Undefined references – LaTeX Warning

Sometimes LaTeX tells you this:

LaTeX Warning: There were undefined references.

If you get this warning, you will notice some ?? in your document at places where references should be. For references to sections, tables of figures, just run pdflatex again (and check for typos). For bibliography references you need to run bibtex.

Let’s assume you are writing a LaTeX file with the name ‘report.tex’. Do the following:

> pdflatex report.tex
[...]
LaTeX Warning: Citation `Liu2010' on page 1 undefined on input line 39.
[...]
LaTeX Warning: Reference `fig:results' on page 1 undefined on input line 65.
[...]
LaTeX Warning: There were undefined references.
[...]
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
[...]
> bibtex report
[...]
> pdflatex report.tex
[...]
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
[...]
> pdflatex report.tex
[...]

You need to run pdflatex again twice after calling bibtex. Twice, because layout may change and things end up somewhere else after you inserted the references.