1

After adding tweaks from other answers here (thanks!) I managed to get authoryear article entries to be like this:

Russell, Bertrand (1905). “On Denoting”. Mind, vol. 14, no. 56, 479–493.

But I need one more tweak: a comma between the article title and the journal name, so to have:

Russell, Bertrand (1905). “On Denoting”, Mind, vol. 14, no. 56, 479–493.

I currently invoke biblatex using:

\usepackage[style=authoryear,natbib=true]{biblatex}

And in biblatex.cfg I have:

\DeclareFieldFormat{postnote}{#1}%

\DeclareFieldFormat{pages}{#1}%

\renewbibmacro{in:}{%
  \ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}

% Comma before and after journal volume
\renewbibmacro*{volume+number+eid}{%
  \setunit*{\addcomma\space}% NEW
  \printfield{volume}%
%  \setunit*{\adddot}% DELETED
  \setunit*{\addcomma\space}% NEW
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}

% Prefixes for journal volume and number
\DeclareFieldFormat[article]{volume}{\bibstring{volume}~#1}% volume of a journal
\DeclareFieldFormat[article]{number}{\bibstring{number}~#1}% number of a journal
6
  • 1
    Maybe you just want \renewcommand*{\newunitpunct}{\addcomma\space} together with \renewcommand*{\labelnamepunct}{\addperiod\space}?
    – moewe
    Jul 25, 2015 at 17:58
  • 1
    Or you go with \renewbibmacro{in:}{% \ifentrytype{article}{\setunit{\addcomma\space}}{\printtext{\bibstring{in}\intitlepunct}}} inestead.
    – moewe
    Jul 25, 2015 at 18:04
  • A few words to the two solutions. The first one will convert almost all periods to commas in the bibliography. Since you seem to already have done this it might do what you want. But it might not do the right thing for non-@articles. The second solution then is specific to @articles only and makes sure a comma is inserted before the journaltitle (given a journaltitle is present, but you would think so in an @article, wouldn't you). (If any of the two helped, a short heads up would be nice, I could prepare a full answer then.)
    – moewe
    Jul 26, 2015 at 5:24
  • Thanks for the answers. The first made me realize I didn't give a full description of the problem. For the OUP house style I'm following I do need periods after all units for books. E.g. Lewis, C. I. (1918). A Survey of Symbolic Logic. Semicentennial publications of the University of California, 1868-1918. Berkeley, CA: University of California Press. But alas solution 2 is not working. I get an inputenc error: Unicode char \u8:​ not set up for use with LaTeX. \renewbibmacro{in:}{% \ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}} works fine.
    – ss1789
    Jul 26, 2015 at 16:48
  • Maybe when you copied the code from this site you copied some junk character. What happens if you type in the \setunit{\addcomma\space} by hand?
    – moewe
    Jul 26, 2015 at 17:01

1 Answer 1

1

Since you only want the change applied to @articles the best course of action is probably to inject the comma into the in: macro like so

\renewbibmacro{in:}{%
  \ifentrytype{article}
    {\setunit{\addcomma\space}}
    {\printtext{\bibstring{in}\intitlepunct}}}

This inserts a comma into the punctuation buffer overwriting the period residing there (for @articles only).

MWE

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

\addbibresource{biblatex-examples.bib}

\DeclareFieldFormat{postnote}{#1}%

\DeclareFieldFormat{pages}{#1}%

\renewbibmacro{in:}{%
  \ifentrytype{article}
    {\setunit{\addcomma\space}}
    {\printtext{\bibstring{in}\intitlepunct}}}


% Comma before and after journal volume
\renewbibmacro*{volume+number+eid}{%
  \setunit*{\addcomma\space}% NEW
  \printfield{volume}%
%  \setunit*{\adddot}% DELETED
  \setunit*{\addcomma\space}% NEW
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}

% Prefixes for journal volume and number
\DeclareFieldFormat[article]{volume}{\bibstring{volume}~#1}% volume of a journal
\DeclareFieldFormat[article]{number}{\bibstring{number}~#1}% number of a journal

\begin{document}

\cite{sigfridsson}

\printbibliography
\end{document}

enter image description here

You must log in to answer this question.

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