2

Biblatex formats working paper references (some have numbers) followed by a period. I would like to change this to a comma.

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@techreport{johndoe1_techreport,
title = {first report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
number = {5},
type = {working paper},
}
@techreport{johndoe2_techreport,
title = {second report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
number = {},
type = {working paper},
}
\end{filecontents}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\addbibresource{\jobname.bib}
\begin{document}
I need a comma after ``5'' in the first reference and one after ``working paper'' in the second.
\textcite{johndoe1_techreport,johndoe2_techreport}
\printbibliography
\end{document}
2
  • Does \renewcommand*{\newunitpunct}{\addcomma\space} what you need? Commented Oct 5, 2017 at 22:13
  • No, because it adds commas to other fields as well, such as the title of an article.
    – Tom Price
    Commented Oct 5, 2017 at 22:33

1 Answer 1

4

Here is a solution, with xpatch and a hack: to avoid a spurious space for a techreport without number, set number={\unskip}.

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@techreport{johndoe1_techreport,
title = {first report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
number = {5},
type = {working paper},
}
@techreport{johndoe2_techreport,
title = {second report},
author = {Dow, John},
year = {2017},
institution = {Stackoverflow University},
type = {working paper},
number = {\unspace}
}
\end{filecontents}
\usepackage[authordate,backend=biber]{biblatex-chicago}

\usepackage{xpatch}
\xpatchbibdriver{report}{%
\newunit
\printfield{note}%
\newunit\newblock}%
{%
\setunit*{\addcomma\addspace}
\printfield{note}%
\setunit*{\addcomma\addspace}\newblock}{}{}
\addbibresource{\jobname.bib}
\nocite{*}

\begin{document}

I need a comma after ``5'' in the first reference and one after ``working paper'' in the second.

\printbibliography

\end{document} 

enter image description here

3
  • I found a way using biblatex commands: \DeclareFieldFormat{number}% {\ifinteger{#1}% {#1\addcomma}% {\addcomma}} This requires a negative integer in the number field. I am not sure why.
    – Tom Price
    Commented Oct 6, 2017 at 22:35
  • @TomPrice: I don't know either, but I see a potential drawback: every number field will end up with a comma, whatever the context. You might obtain something like 5,.. Punctuation is not part of a field format: it should be specified in bibliographyy drivers, between two fields, or after a bib macro has been executed.
    – Bernard
    Commented Oct 6, 2017 at 22:57
  • I can restrict the declare statement to reports using \DeclareFieldFormat[report]{number}...
    – Tom Price
    Commented Oct 7, 2017 at 0:25

You must log in to answer this question.

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