0

I'm currently writing my thesis, and due to the fact that I already have close to 30 sources, I want to use the vancouver/numeric bibliography style instead of APA. However, I run into some problems when trying to use either of them. Both do not show the year of my bib entries, although they are present in my .bib file.

APA (APA)

Vancouver (Vancouver)

Numeric (Numeric)

This is the code that is in my main.tex. Please note that I did not write the documentclass or the main myself, I've added things, but I'm not the creator.

\usepackage[
style=apa,
backend=biber,
sortcites=true,
sorting=none,
url=true,
doi=true,
hyperref=false,
backref=false,
natbib=false,
]{biblatex}

\newcommand{\mkbibnodate}{n\adddot d\adddot}
\AtEveryCitekey{\iffieldundef{labelyear}{\restorefield{labelyear}{\mkbibnodate}}{}}
\AtEveryBibitem{\iffieldundef{labelyear}{\restorefield{year}{\mkbibnodate}}{}}

\DeclareLanguageMapping{dutch}{dutch-apa}
\DefineBibliographyStrings{dutch}{andothers = {et al.}}

\addbibresource{bib.bib}
\setlength{\bibitemsep}{1.5 \itemsep}

This is the bib entry that can be seen in the images

@book{kleinwoud_stapersma,
author = {Hans {Klein Woud} and D. Stapersma},
title = {{Design of Propulsion and Electric Power Generation Systems}},
edition = {},
pages = {},
year = {2002},
isbn = {978-1-902536-47-9},
URL = {},
publisher = {IMarEST, Institute of Marine Engineering, Science and Technology}
}

Does anyone know what possibly could lead to this problem, and what I could do to fix this? If I need to proivde any more information, please let me know.

I found this question. The problem here was a missing ,. I checked my .bib, all , and {} are present. I do not have any errors, except a warning that says the ISBN in my bib entry is invalid.

Thanks in advance!

1
  • 2
    Welkom op TeX.SE! The three lines starting with \newcommand and the two following lines (starting with \AtEveryCitekey and \AtEveryBibitem) seem very suspicious. Delete them and see if that leads to some improvement.
    – Marijn
    May 21, 2021 at 20:48

1 Answer 1

1

As mentioned in the comments, the problem is indeed your n.d. code. However, if you just delete those lines, then for sources that don't have a date, you won't see n.d. either.

You were looking at labelyear, which isn't used by numeric style, only year is. It is indeed used in apa style, but even there things were going wrong; when labelyear is undefined, which it often is, then year would be used, but you were not checking if year was defined.

Anyway, this should do the trick:

\AtEveryBibitem{
    \iffieldundef{year}{
        \restorefield{year}{\mkbibnodate}
    }{}
}
\AtEveryCitekey{%
    \iffieldundef{year}{%
        \restorefield{year}{\mkbibnodate}%
    }{}%
}

Note the percent signs prevent extra whitespace in your cite brackets. They comment out the newline character at the end of the line, which would else be converted to a space.

Has this answer helped you?

4
  • Thanks so much! This really helped a lot. Is labelyear only used in APA, or also in different bibliography styles? Just using year instead of labelyear will fix the problem for all different styles then right. Are you supposed to have labelyear = ... in your .bib file? Because I indeed do not work with labelyear, all my entries have always used year.
    – annie
    May 22, 2021 at 12:00
  • @annie glad to have helped a fellow Dutchman! To be honest, the labelyear vs year confuses me a bit too. I think it's just another field which you can use to give extra formatting or localization, however I've not been able to find a good description in the biblatex documentation. May 22, 2021 at 12:48
  • So just think of labelyear as an override. You keep year in APA clean, because it is used for sorting and stuff, but if you want to have it printed differently, assigning the field labelyear would be how to do it May 22, 2021 at 12:55
  • I've just found empirically that labelyear doesn't work in numeric, I don't think there is a good overview of which styles do. It's just a matter of seeing what works, like you did with your post here. At any rate, don't use labelyear in your .bib, year is how you should do it. Including a field labelyear isn't even recognized for me. May 22, 2021 at 12:59

You must log in to answer this question.

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