[Tex/LaTex] Biblatex-apa style shouldn’t show issue number in references for journal publications with doi

apa-stylebiblatex

A journal article with doi number shouldn't show the issue number according to the APA6 publication manual. However, my biblatex-apa style (with biber) shows it. Does anyone know a good way to remove the issue number automatically if the journal article has a doi number?

Now it looks like this:

Weber, M. & Ruch, W. (2012). The role of character strengths in adolescent romantic relationships: An initial study on partner selection and mates’ life satisfaction. Journal of adolescence, 35(6), 1537– 1546. doi:10.1016/j.adolescence.2012.06.002

But should look like this:

Weber, M. & Ruch, W. (2012). The role of character strengths in adolescent romantic relationships: An initial study on partner selection and mates’ life satisfaction. Journal of adolescence, 35, 1537– 1546. doi:10.1016/j.adolescence.2012.06.002

This is how my test-document looks like:

\documentclass[12pt, onecolumn]{apa6}


\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style= apa, backend=biber]{biblatex}
\bibliography{testbib}
\DeclareLanguageMapping{american}{american-apa}


\begin{document}

Some text \parencite{Weber2012} and \parencite{belbin1993}.

\printbibliography
\end{document}

And the test-bib-file:

@article{Weber2012,
abstract = {},
author = {Weber, M. and Ruch, W.},
doi = {10.1016/j.adolescence.2012.06.002},
file = {},
issn = {1095-9254},
journal = {Journal of adolescence},
number = {6},
pages = {1537--1546},
pmid = {22749517},
publisher = {Elsevier Ltd},
title = {{The role of character strengths in adolescent romantic relationships: An initial        study on partner selection and mates' life satisfaction.}},
url = {http://www.ncbi.nlm.nih.gov/pubmed/22749517},
volume = {35},
year = {2012}
} 

@article{belbin1993,
author = {Belbin, R Meredith},
journal = {Journal of Occupational and Organizational Psychology},
number = {3},
pages = {259--260},
publisher = {Wiley Online Library},
title = {{A reply to the Belbin Team-Role Self-Perception Inventory by Furnham, Steele and Pendleton}},
volume = {66},
year = {1993}
}

In this example Weber & Ruch (2012) should not have an issue number (because it has a doi) and Belbin (1993) should have an issue number (because it doesn't have a doi).
I'd be very thankful for a solution 🙂

Best Answer

We can use the following test to detect whether the bib item is an @article with a DOI field, if so, we delete the number.

\AtEveryBibitem{%
  \ifboolexpr{test {\ifentrytype{article}} and not test {\iffieldundef{doi}}}
    {\clearfield{number}}
    {}%
}

MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa, backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{Weber2012,
  author    = {Weber, M. and Ruch, W.},
  doi       = {10.1016/j.adolescence.2012.06.002},
  issn      = {1095-9254},
  journal   = {Journal of adolescence},
  number    = {6},
  pages     = {1537--1546},
  pmid      = {22749517},
  publisher = {Elsevier Ltd},
  title     = {The Role of Character Strengths in Adolescent Romantic Relationships},
  subtitle  = {An Initial Study on Partner Selection and Mates' Life Satisfaction},
  url       = {http://www.ncbi.nlm.nih.gov/pubmed/22749517},
  volume    = {35},
  year      = {2012},
} 
@article{belbin1993,
  author    = {Belbin, R Meredith},
  journal   = {Journal of Occupational and Organizational Psychology},
  number    = {3},
  pages     = {259--260},
  publisher = {Wiley Online Library},
  title     = {A Reply to the {Belbin} {Team-Role} {Self-Perception} {Inventory} by {Furnham}, {Steele} and {Pendleton}},
  volume    = {66},
  year      = {1993},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\DeclareLanguageMapping{american}{american-apa}

\AtEveryBibitem{%
  \ifboolexpr{test {\ifentrytype{article}} and not test {\iffieldundef{doi}}}
    {\clearfield{number}}
    {}%
}

\begin{document}
  Some text \parencite{Weber2012,belbin1993}.

  \printbibliography
\end{document}

enter image description here