11

I would like to consistently have a comma between the journal and volume number for article references using biblatex with biber as the backend. Unfortunately, the punctuation between the journal and volume is not consistent. Journals whose last word is abbreviated have no comma between the journal and the volume, and the word "Vol." is capitalized. Journals whose last word is not abbreviated have a comma and the word "vol." is not capitalized. I can fix the capitalization by un-commenting the commented lines in the below MWE, but the comma problem is quite perplexing. Apologies if this fix is in an answer somewhere, but I cannot find it (or at least, I don't know what to search for!).

Current output:
[1] First Author. “Blah Blah 2”. In: Am. J. Phys. Vol. 72, no. 3 (Mar. 2004), pp. 367–375.
[2] Second Author. “Blah blah”. In: Energy Fuel, vol. 27, no. 12 (Dec. 2013), pp. 7778–7789.

Expected output:
[1] First Author. “Blah Blah 2”. In: Am. J. Phys., vol. 72, no. 3 (Mar. 2004), pp. 367–375.
[2] Second Author. “Blah blah”. In: Energy Fuel, vol. 27, no. 12 (Dec. 2013), pp. 7778–7789.

MWE:

\documentclass{article}
\usepackage{filecontents}
\usepackage[
    backend=biber,
    citestyle=numeric-comp,
]{biblatex}
\addbibresource{\jobname}
% \DefineBibliographyStrings{english}{%
    % volume = {\lowercase{v}ol\adddot}, % avoid capitalization after dots.
% }
\DeclareFieldFormat[article]{volume}{\bibstring{volume}\addspace #1}
\DeclareFieldFormat[article]{number}{\bibstring{number}\addspace #1}
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
  \setunit{\addcomma\space}%<---- was \setunit*{\adddot}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addcomma\addspace}%<---- was \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

\begin{filecontents*}{\jobname.bib}
@article{York2004,
author = {Author, First},
journal = {Am. J. Phys.},
month = mar,
number = {3},
pages = {367--375},
title = {{Blah Blah 2}},
volume = {72},
year = {2004}
}
@article{Baumgardner2013a,
author = {Author, Second},
journal = {Energy Fuel},
month = dec,
number = {12},
pages = {7778--7789},
title = {{Blah blah}},
volume = {27},
year = {2013}
}
\end{filecontents*}

\begin{document}
\nocite{*}
\printbibliography
\end{document}
2
  • 1
    That is because the journal in York2004 ends with a . dot. The dot is then treated as such to avoid double punctuation.
    – moewe
    Apr 9, 2014 at 14:42
  • Yes, but it is an abbreviation, not the end of a sentence. I want the double punctuation.
    – darthbith
    Apr 9, 2014 at 14:43

1 Answer 1

10

The problem is that biblatex treats the abbreviation dot in journal = {Am. J. Phys.} as a literal period (the end of a sentence).

We can stop biblatex from doing that by using \isdot

\DeclareFieldFormat{journaltitle}{\mkbibemph{#1\isdot}}

As per the biblatex documentation §4.7.3 Adding Punctuation, p. 191:

\isdot Turns a previously inserted literal period into an abbreviation dot. In contrast to \adddot, nothing is inserted if this command is not preceded by a period.

This solution will treat all trailing periods in the journal field as abbreviation dots.

If you only want that for particular cases, you could consider adding \isdot to the journal field manually (journal = {Am. J. Phys.\isdot} or write journal = {Am\adddotspace J\adddotspace Phys\adddot} using the host of commands biblatex provides for these matters). This is is not to be recommended as it will make the .bib file less portable though.

MWE

\documentclass{article}
\usepackage{filecontents}
\usepackage[
    backend=biber,
    citestyle=numeric-comp,
]{biblatex}
\addbibresource{\jobname.bib}
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}\isdot}
\DeclareFieldFormat[article]{volume}{\bibstring{volume}\addspace #1}
\DeclareFieldFormat[article]{number}{\bibstring{number}\addspace #1}
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
  \setunit{\addcomma\space}%<---- was \setunit*{\adddot}%
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addcomma\addspace}%<---- was \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

\begin{filecontents*}{\jobname.bib}
@article{York2004,
author = {Author, First},
journal = {Am. J. Phys.},
month = mar,
number = {3},
pages = {367--375},
title = {{Blah Blah 2}},
volume = {72},
year = {2004}
}
@article{Baumgardner2013a,
author = {Author, Second},
journal = {Energy Fuel},
month = dec,
number = {12},
pages = {7778--7789},
title = {{Blah blah}},
volume = {27},
year = {2013}
}
\end{filecontents*}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

2
  • Thanks for the detail! I should probably just read the biblatex docs all the way through... maybe after I graduate :-)
    – darthbith
    Apr 9, 2014 at 15:04
  • @darthbith That will surely be a very gripping read ;-).
    – moewe
    Apr 9, 2014 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .