Hi community,
Weird problem with latex and jabref:
In the list of references at the end of the document the year of a reference is only shown, when in jabref the field “Date” of the corresponding source is empty. If the year is written there, it does not show at the end of the reference in the pdf.
The opposite would make sense to me. Someone has an idea about this ?
Indeed, weird. I doubt this could be related to JabRef: JabRef only takes care of the bib file, not about what LaTeX does with it.
Anyway, to help you, we would need a minimum example, i.e. the shortest possible LaTeX document that shows the issue (with 2 references only: one showing the problem and one not showing it).
Cheers.
For the citationkey zheng2017porous the field “date” in jabref is empty. There is no warning in latex and the year is shown at the end of the reference.
Eventhough the year is saved in the jabref field “Date” for the citationkey bhide2014electrochemical, there is a waring that the year is empty and the year is not shown in the reference.
Latex Code:
\documentclass[a4paper, 12pt]{scrartcl}
\usepackage[ngerman,english]{babel}
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage{psfrag}
\usepackage{ifpdf}
\begin{document}
\section{a}
Empty Date field: \cite{zheng2017porous}
\\
2014 in Date field: \cite{bhide2014electrochemical}
Ultimately, what fields are printed strongly depends on your citationstyle.
The logic in the style decides which data is used to be printed. Apparently your style dictates to prefer date over year, which is fine, because you would not want to have something like “1987, 1987-1998” in your references…
The old BibTeX standard (no active development) uses the “year”, “month” “day” fields, whereas the newer BibLaTeX standard (active development here) introduced the “date” field, which is supposed to follow ISO 8601 syntax (e.g now supports date ranges and time). Of course, if you still have data in the “year” field, you can use that, but if push comes to shove, the “date” field might be the way to go, especially if your citationstyle prioritizes the “date” field.
JabRef offers the possibility to move data from selected fields to other fields, e.g. from year field to the date field. Check out edit > automatic field editor. (Make sure to have a backup of your library, before making huge changes!)
to 1.) I tried several bibliographystyles, all with the same result.
Make no mistake. 1987-1998 is no information about a year or date. These are the pages in the journal were it was published. The year (2014 in this case) is supposed to come afterwards, as it is shown in the other source.
By the way, does the following minimal example gives the same issues:
\documentclass{article}
\begin{document}
Empty Date field: \cite{zheng2017porous}
\\
2014 in Date field: \cite{bhide2014electrochemical}
\bibliographystyle{unsrt}
\bibliography{Literaturverzeichnis}
\end{document}
I found the difference in the biblatex soure tab, as you suggested:
For Bhide2014 (were the year was missing): The year is called date, just like in the main Tab “Required Fields”: date = {2014}
For Zheng2017 (were the year was printed, eventhough the date in the Tab “Required Fields” was empty):
instead of date = {}, there is year = {2017}.
The question now is, why the field “date” is required, if it will not be printed, and the field “year” is not required?
I can also tell you why i sometimes have year and sometimes date:
With the help of Google Scholar, you can create the code for bibTEX. This gives you year, and it is fine
With jabref itself you can generate the bibTEX codes as well, when you press “new entry” and the paste the DOI. This gives no year, but a date and that is the source of the problem.
You might call this a bug, but this methode just meets the “required fields”. So rather the bug is, that “date” is a required field and “year” is not.
For the BibTeX format, you have to use year.
For the biblatex format, you have to use date.
JabRef can deal with both BibTeX and biblatex libraries.
To check on this, go to Library → Library properties and look at the library mode.
If you have some references with the wrong format, Quality → Cleanup entries has some options that can help you.
Cheers.