I am writing my thesis and am struggling to create a citation within Latex code. I get following error:
Warning: LaTeX Warning: Citation `2023TylerIyengarTestingRobustnessANES' on page 12 undefined on input line 194. Warning: LaTeX Warning: Citation `2023TylerIyengarTestingRobustnessANES' on page 12 undefined on input line 194. Warning: LaTeX Warning: There were undefined references.
So far, I have always cited in my markdown document via [@citationkey], without issue. However, in my following figure I cannot achieve a successful reference:
begin{figure}[t]
centering
includegraphics[width=0.50textwidth]{resources/p_thermometer.pdf}
caption[ANES Feeling Thermometer Time Series]{ANES Feeling Thermometer between 1978 and 2020. Grouped by group bias: feelings towards own party (in-party) and feelings towards opposing party (out-party). Retrieved via {cite{2023TylerIyengarTestingRobustnessANES}} and visually recreated.}
label{fig:Feeling-Thermometer-via-Tyler-Iyengar-2023}
end{figure}
I can guarantee that the citation key is correct and included in my bibliography file. I also tried protecting the cite command (either via protect or {}), without success. For testing purposes I tried inserting [@2023TylerIyengarTestingRobustnessANES] after the Latex code and it works. My YAML looks as follows:
---
title: "Thesis"
author: ""
date: "`r Sys.Date()`"
output:
bookdown::pdf_document2:
output_file: "thesis_output_file.pdf"
number_sections: true
toc: false
toc-title: "Table of Contents"
bibliography: resources/thesis-references.bib
geometry: "left = 2.5cm, right = 2.5cm, top = 2.5cm, bottom = 2.5cm"
fontsize: 12pt
link-citations: true
csl: resources/apa.csl
header-includes:
- usepackage{hyperref}
- newcommand{fullref}[1]{hyperref[#1]{Figure ref*{#1}}}
- usepackage[font=footnotesize,labelfont=bf,labelsep=colon]{caption}
- usepackage{float}
- pagenumbering{gobble}
- usepackage{setspace}doublespacing
- renewcommand{familydefault}{sfdefault}
- newcounter{romanpage}
- renewcommand{contentsname}{Table of Contents}
---