2

I have a problem with inserting references from my .bib file into my LaTeX document. Even though it runs when I only put in \bibliography{name of my file}, it cannot find the actual reference when I put \cite{citation key} (error: undefined reference). I made sure that the citation key is correct. Also I want the reference to appear in the footnotes. Can anyone see where I made the mistake?

\documentclass[12pt]{scrbook}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\setmainfont{Charter}

\usepackage[backend=bibtex,style=verbose-trad2]{biblatex}
\bibliography{Masterarbeit} 
\bibliographystyle{siam}

\usepackage{geometry}
\geometry{top=25mm, left=20mm, right=30mm, bottom=20mm, headsep=10mm, footskip=12mm}
\usepackage{graphicx}
\usepackage[onehalfspacing]{setspace}

\makeatletter
\renewcommand\normalsize{\@setfontsize\normalsize{12}{14.4}}
\renewcommand\large{\@setfontsize\large{14}{16.8}}
\renewcommand\LARGE{\@setfontsize\LARGE{18}{21.6}}
\renewcommand\huge{\@setfontsize\huge{20}{24}}
\makeatother

\newcommand{\chapnumsize}{\LARGE}
\newcommand{\chapnumstyle}{\normalfont\mdseries}
\newcommand{\chapsize}{\huge}
\newcommand{\chapstyle}{\mdseries}
\newcommand{\secsize}{\large}
\newcommand{\secstyle}{\mdseries}

\addtokomafont{part}{\mdseries}
\addtokomafont{partnumber}{\mdseries}
\addtokomafont{chapter}{\mdseries}
\addtokomafont{section}{\mdseries}

\setkomafont{disposition}{\normalcolor\bfseries}


\begin{document}

\chapter{Fragebogen} 
\section{...}
I want to put a reference in a footnote \cite{Carbon2019}

\end{document}
Mensch
  • 65,388
Clara
  • 21
  • Welcome to TeX.SE! Please show us the entry for Carbon2019 in your bib file in your question. – Mensch May 14 '20 at 10:34
  • Common issues are the lack of commas after each field for Carbon2019, not saving the bib file after adding the new entry or not compiling two times the tex file. – epsilone May 14 '20 at 10:58
  • latex never loads the bib file, have you run bibtex to generate the bibliography? – David Carlisle May 14 '20 at 11:12
  • Thank you for your responses! Here is the entry for the citation as generated by JabRef: @Article{Carbon2019, author = {Carbon, C. C.}, journal = {Journal of Perceptual Imaging}, title = {Empirical Approaches to Studying Art Experience}, year = {2019}, number = {1}, volume = {2}, groups = {Perceptual processes}, } – Clara May 14 '20 at 11:32
  • 1
    Since you're using the biblatex package, you must get rid of the \bibliographystyle statement. You should also replace \bibliography{Masterarbeit} with \addbibresource{Masterarbeit.bib}. – Mico May 14 '20 at 12:31
  • Thanks Mico! However, it is still not working. I think that there is an issue with my bib file that I have to fix first... – Clara May 14 '20 at 14:01
  • You must not use \bibliographystyle with biblatex. Remove the \bibliographystyle{siam}. You probably want to use \autocite{Carbon2019} instead of \cite{Carbon2019}. After you have changed these two things, go to your document folder and delete the .aux and .bbl files. Then rerun LaTeX, BibTeX, LaTeX, LaTeX. ... – moewe May 14 '20 at 14:44
  • ... If you still get unexpected results, please find and post the contents of the .blg file. On Windows systems the .blg file may be recognised as "performance monitor" file or some such, but it is just a simple text file you can open with your favourite text editor. – moewe May 14 '20 at 14:45
  • One last thing: It is not clear to me whether you (or maybe your editor) have run BibTeX. Your document must be compiled with LaTeX, BibTeX, LaTeX, LaTeX in order to properly generate all references. Why that is necessary is explained brilliantly in https://tex.stackexchange.com/q/63852/35864 (so please head over there and give the answer a short read). – moewe May 14 '20 at 14:49
  • Thank you @moewe! I already did compile with LaTeX, BibTeX, LaTeX, LaTeX. I am actually using LuaLaTeX. Does this make any difference? I copied the contents of the .blg file generated for my main file: – Clara May 15 '20 at 12:02
  • This is BibTeX, Version 0.99d (TeX Live 2019) Capacity: max_strings=100000, hash_size=100000, hash_prime=85009 The top-level auxiliary file: Masterarbeit_Text.aux I found no \citation commands---while reading file Masterarbeit_Text.aux I found no \bibdata command---while reading file Masterarbeit_Text.aux I found no \bibstyle command---while reading file Masterarbeit_Text.aux You've used 0 entries, 0 wiz_defined-function locations, 83 strings with 508 characters, and the built_in function-call counts, 0 in all, are: – Clara May 15 '20 at 12:03
  • = -- 0

    -- 0

    < -- 0

    • -- 0
    • -- 0
    • -- 0

    := -- 0 add.period$ -- 0 call.type$ -- 0 change.case$ -- 0 chr.to.int$ -- 0 cite$ -- 0 duplicate$ -- 0 empty$ -- 0 format.name$ -- 0 if$ -- 0 int.to.chr$ -- 0 int.to.str$ -- 0 missing$ -- 0 newline$ -- 0 num.names$ -- 0 pop$ -- 0 preamble$ -- 0 purify$ -- 0 quote$ -- 0 skip$ -- 0 stack$ -- 0 substring$ -- 0 swap$ -- 0 text.length$ -- 0 text.prefix$ -- 0 top$ -- 0 type$ -- 0 warning$ -- 0 while$ -- 0 width$ -- 0 write$ -- 0 (There were 3 error messages)

    – Clara May 15 '20 at 12:03
  • No, LuaLaTeX does not make a difference for the general procedure. You would just call LuaLaTeX, BibTeX, LuaLaTeX, LuaLaTeX (sometimes when I post a comment like this I include a note that "LaTeX" can be replaced by pdfLaTeX, LuaLaTeX, XeLaTeX at will). The relevant bits from your .blg file are I found no \citation commands---while reading file Masterarbeit_Text.aux I found no \bibdata command---while reading file Masterarbeit_Text.aux I found no \bibstyle command---while reading file Masterarbeit_Text.aux. That means that BibTeX can't find any citation info. ... – moewe May 15 '20 at 12:16
  • ... Does that .blg file come from the code shown in the question or already from the code as changed in the answer? If you removed the option backend=bibtex, you are switching to the default backend=biber, and need to run BibTeX instead of Biber in the compilation sequence. See https://tex.stackexchange.com/q/154751/35864 for help with getting your editor to run Biber instead of BibTeX. – moewe May 15 '20 at 12:17

1 Answers1

3

It looks like there is probably something wrong in the path of \bibliography{} command.

In the MWE that follows, the relevant lines to the successful creation of the bibliography are:

\usepackage[style=verbose-trad2]{biblatex}
\addbibresource{\jobname.bib} % include the path to your .bib file

in which I've removed the \bibliographystyle{} command (the style= option has to be used) and replaced \bibliography with \addbibresource{}. If you do not specify any backend, compile with Biber after LaTeX.

Finally, in the text, use \autocite{}.

Commenting out all that is non relevant to the reproduction of your problem, this is a MWE:

\begin{filecontents}{\jobname.bib}
    @Article{Carbon2019,
        author = {Carbon, C. C.},
        journal = {Journal of Perceptual Imaging},
        title = {Empirical Approaches to Studying Art Experience},
        year = {2019},
        number = {1},
        volume = {2},
        groups = {Perceptual processes},
    }
\end{filecontents}

\documentclass[12pt]{scrbook} % \usepackage[ngerman]{babel} % \usepackage{fontspec} % \setmainfont{Charter}

\usepackage[style=verbose-trad2]{biblatex} \addbibresource{\jobname.bib}

% \usepackage{geometry} % \geometry{top=25mm, left=20mm, right=30mm, bottom=20mm, headsep=10mm, footskip=12mm} % \usepackage{graphicx} % \usepackage[onehalfspacing]{setspace}

% \makeatletter % \renewcommand\normalsize{@setfontsize\normalsize{12}{14.4}} % \renewcommand\large{@setfontsize\large{14}{16.8}} % \renewcommand\LARGE{@setfontsize\LARGE{18}{21.6}} % \renewcommand\huge{@setfontsize\huge{20}{24}} % \makeatother

% \newcommand{\chapnumsize}{\LARGE} % \newcommand{\chapnumstyle}{\normalfont\mdseries} % \newcommand{\chapsize}{\huge} % \newcommand{\chapstyle}{\mdseries} % \newcommand{\secsize}{\large} % \newcommand{\secstyle}{\mdseries}

% \addtokomafont{part}{\mdseries} % \addtokomafont{partnumber}{\mdseries} % \addtokomafont{chapter}{\mdseries} % \addtokomafont{section}{\mdseries}

% \setkomafont{disposition}{\normalcolor\bfseries}

\begin{document}

\chapter{Fragebogen} \section{...} I want to put a reference in a footnote \autocite{Carbon2019}

\end{document}

enter image description here

  • 1
    If you look at the edit history of the answer, it was initially as you say :) – Alessandro Cuttin May 14 '20 at 12:46
  • 1
    Good use of \autocite! But please mention explicitly that \bibliographystyle must not be used with biblatex, so \bibliographystyle{siam} must be removed. (It's commented out in your code, but it may not be clear to every reader that it is commented out because it must be removed and not just because it is irrelevant to the issue). It may also be useful to explicitly point out that you switched to \addbibresource{<file>.bib} from \bibliography{<file>} (which is a good choice, but not necessary, \bibliography{Masterarbeit} should work if the file exists). – moewe May 14 '20 at 14:48
  • thanks @moewe, earlier today I answered on the fly. I've updated the answer following your suggestions. – Alessandro Cuttin May 14 '20 at 17:29
  • 2
    The .bib file extension is mandatory when \addbibresource is used. (Please correct the comment the file extension is not mandatory in the first code block.) – moewe Jun 29 '20 at 15:50