0

I used to refer without problems using a bibtex file in Latex that was generated by Mendeley. Now , suddenly when i want to cite references i didn't cite before i get the warning ' citation on page XX undefined.' When i want to cite references i cited before in the document, it works fine ... I can't figure out what went wrong? I also updated the bibtex file using Mendeley and started Latex again but this didn't help.

Thus us what my .bib file looks like

@article{Meyer2016,
author = {Meyer, Thomas},
doi = {10.3390/microorganisms4030025},
file = {:C$\backslash$:/Users/thais/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Meyer - 2016 - Diagnostic Procedures to Detect Chlamydia trachomatis Infections.pdf:pdf},
keywords = {amplification tests,cervicitis,chlamydia trachomatis,enzyme immunoassay,line assay,lymphogranuloma,non gonococcal urethritis,pelvic inflammatory disease,rapid diagnostic test},
title = {{Diagnostic Procedures to Detect Chlamydia trachomatis Infections}},
year = {2016}
}

this is how my main document looks like :

\documentclass[a4,11pt,english,twoside,openany]{book}
% online:
%\documentclass[a4,11pt,dutch,oneside,openany]{book}
\pdfoptionpdfminorversion=5
% over the course of making multiple documents, I have acquired a fairly long list of packages that I am using/loading. Probably not all of them are necessary for most documents. You can comment-out useless packages with %.
%% PACKAGES FOR LANGUAGE STUFF %%
\usepackage[latin1,utf8]{inputenc}                      %  The package translates various standard and other input encodings into a 'LaTeX internal language'. Allows you to type certain characters directly (eg. é, ©, £, ß, ...)
\usepackage[english]{babel}                     % Controls hyphenation. Use this when you use another language than English
\input{hyphenation.tex}                                 % This file should be in the same folder as your main .tex document. You can add hyphenations here in case the default is not included or wrong. Primarily useful for non-Enlish docs


%% PACKAGES FOR LAYOUT AND WRITING%%
\usepackage{hyperref}                                   % For hyperlinks in the PDF
\usepackage[times]{quotchap}                            % Decorative chapter headings. A package for creating decorative chapter headings with quotations
\usepackage[sumlimits]{amsmath}                         % AMS mathematical facilities for LaTeX
\usepackage{amsthm}                                     % Typesetting theorems (AMS style)
\usepackage[vlined,ruled]{algorithm2e}                  % Algorithm2e is an environment for writing algorithms
\usepackage{verbatim}                                   % write latex code in your pdf
\usepackage{float}                                      % Controls floats
\usepackage[a4paper,verbose, centering,reversemp]{geometry} % Adjust page dimensions
\usepackage{fancyhdr}                                   %  Extensive control of page headers and footers
\usepackage{times}                                      % Select Adobe Times Roman (or equivalent) as default font
\usepackage{wrapfig}                                    % Allows figures or tables to have text wrapped around them.
\usepackage{floatflt}                                   % Wrap text around floats
\usepackage[round]{natbib}                              % om author-year citation te maken
\usepackage{xcolor}                                     % Driver-independent color extensions for LaTeX
\usepackage{multicol}                                   % Multicol defines a multicols environment which typesets text in multiple columns
\usepackage{graphicx}                                   % steering the \importgraphics command
%\usepackage[version=3]{mhchem}                         % The mhchem package provides commands for typesetting chemical molecular formulae and equations.
\usepackage{enumitem}                                   % provides user control over the layout of the three basic list environments: enumerate, itemize and description
\usepackage[nottoc,numbib]{tocbibind}                   % add bibliography to toc
\usepackage[calcwidth,newparttoc]{titlesec}             % A package providing an interface to sectioning commands for selection from various title styles
\usepackage[osf]{mathpazo} % 'o'ld 's'tyle 'f'igures are used in the manual, but you can leave this away, of course. 
\usepackage{siunitx}
\usepackage{isotope} %isotope benoemen \isotope[18]{O}
\usepackage{newtxtext,newtxmath,amsmath} %for perthousand sign
\usepackage{amsmath} %label equations
\usepackage{nomencl} %forabbrevations
\makenomenclature
\usepackage{glossaries}
\makeglossaries
\usepackage{incgraph,tikz}
\usepackage{afterpage}
\usepackage{pdfpages}
\usepackage[table,xcdraw]{xcolor}

%refer to multiple figures:
%\usepackage[colorlinks]{hyperref}
\usepackage[nameinlink]{cleveref}
\Crefname{figure}{Fig.}{Figs.}
\newcommand\crefrangeconjunction{--}

%abbreviations
\newlist{abbrv}{itemize}{1}
\setlist[abbrv,1]{label=,labelwidth=1in,align=parleft,itemsep=0.1\baselineskip,leftmargin=!}


%% PACKAGES FOR TABLES %%
\usepackage{booktabs,tabularx}                          % fancy, scientific-looking tables
\newcolumntype{Y}{>{\centering\arraybackslash}X}        % own definitions for columns in tables
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}   % own definitions for columns in tables
\usepackage{multirow}                                   % Create tabular cells spanning multiple rows
\usepackage{hhline}                                     % The command \hhline produces a line like \hline, or a double line like \hline\hline, except for its interaction with vertical lines.
\usepackage{caption}  %font={small},labelfont={bf},center
\captionsetup{justification=raggedright,singlelinecheck=false,textfont={small},textfont=it,labelfont={bf,it}} % define the settings of your captioning of figures and tables
\usepackage{lscape}                                     % landscape for tables etc. 
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{graphicx}


%% OTHER PACKAGES
\usepackage{datetime}                                   % for the date/time of today on the version timestamp
\usepackage{pdfpages}                                   % if you want to insert pdf in your document 
\usepackage{gensymb}                                  %om graden bolletje te kunnen doen
\usepackage{amssymb,listings,color,textcomp,marvosym,flafter,longtable,subcaption,amsfonts,rotating}
\usepackage{array,pstricks,listings}

\definecolor{chaptergray}{rgb}{0.85,0.85,0.85}
\parskip=\medskipamount

\DeclareGraphicsExtensions{jpg,png}

\input{page_layout_definition}                          % This command will load the page_layout_definition file, which defines the general layout for this document. Credits for this fi


% In the preamble, you can also define your own extra commands:
%---------------------------------------------------------------------------
% Short version commando to introduce figures. 
%---------------------------------------------------------------------------
%\mijnfiguur[H]{width=5cm}{bestandsnaam}{Het bijschrift bij deze figuur}{label}
\newcommand{\mijnfiguur}[5][ht]{            % Het eerste argument is standaar `ht'.
    \begin{figure}[#1]                      % Beginnen van de figure omgeving
        \begin{center}                      % Beginnen van de center omgeving
            \includegraphics[#2]{#3}        % Het eigenlijk invoegen van de figuur (2: opties, 3: bestandsnaam)
        \end{center}
        \caption{#4}          % Het bijschrift (argument 4) en het label (argument 5)
        \label{#5}
    \end{figure}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% now everything is set to start writing. Let's begin the document:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

    \selectlanguage{english}                    %kies hier je taal
    \lstset{language=Matlab,commentstyle=, framexleftmargin=5mm,belowcaptionskip=5mm,
        frame=single,basicstyle={\ttfamily\small},
        stringstyle=\small,commentstyle=\textcolor[rgb]{0.53,0.53,0.53},
        backgroundcolor=\color[rgb]{0.93,0.93,0.93},showspaces=false,framexleftmargin=-2pt,showstringspaces=false,upquote=true}

    \frontmatter
    \includepdf[pages=-]{Voorblad.pdf}
    \thispagestyle{empty}           % insert your title page called 'Titelpagina.tex'
    \newpage\mbox{}\newpage
    \inputencoding{latin1}
    \include{Copyright}                 % insert your copyright called 'Copyright.tex'
    \newpage\mbox{}\newpage
    \inputencoding{utf8}
    \include{Voorwoord}
    \tableofcontents
    %\listoffigures
    %\listoftables
    %\newpage\mbox{}\newpage
    \include{Abbreviations}
    \include{Abstract}
    \include{Samenvatting}
    \include{Introduction}





    \mainmatter                             % Here you can insert blocks of text, chapters, etc....
    \include{Chapter1}
    \frontmatter
    \include{Objectives}
    \include{Corona}
    \mainmatter
    \include{Chapter2}
    \include{Chapter3}
    \include{Chapter4}
%   \include{chapter6}
%   \include{chapter7}
%   \include{chapter8}
    \let\secfnt\undefined
    \newfont{\secfnt}{ptmb8t at 9pt}

    \bibliographystyle{abbrvnat}
    \bibliography{library}  

    \include{Appendix}


´%\begin{figure} [ht]
%   \begin{center}
%       \includegraphics[width=\linewidth]{Figuren/lianen2.pdf}
%   \end{center}
%   \caption{Fitting of the \texorpdfstring{g\textsubscript{s}}{gs}-VPD data of liana leaves %with a linear (yellow), logarithmic (blue) and exponential (green) regression.}
%   \label{fig:lianen2} 
%\end{figure}


\end{document}

This is how i cited in my text : ( Chapter 1)

The technique that is used for detection is determined by the type of samples that are available \citep{Sachse2009}. The methodologies and techniques that are currently used for the diagnosis of chlamydial infections will be discussed below \citep{Meyer2016}.

Instead of the references a question mark showed up ...

I hope someone can help me out !

5
  • 1
    Unrelated to the actual problem, but your preamble contains a lot of code and loads a lot of packages. Do you need all of them? Do you know why you load each package? Some packages are loaded multiple times (that is usually a bad idea and can even be an error if a package is loaded multiple times with different options). – moewe May 14 '20 at 14:58
  • As the code shown so far is now we can not run it, because it contains references to a large number of external files we don't have (Abbreviations, Abstract, Samenvatting, Introduction, Chapter1, ...). All I can say at the moment is that the .bib entry shown is not faulty as such (and should not produce irrecoverable errors), but it does not appear to be complete: An @article should have a journal and usually also has a volume, pages (sometimes a number) field. – moewe May 14 '20 at 15:02
  • Did you run LaTeX, BibTeX, LaTeX, LaTeX on your document? (Maybe you editor does that for you automatically in some, but not all situations.) See tex.stackexchange.com/q/63852/35864 for a brilliant explanation why that is needed. – moewe May 14 '20 at 15:03
  • I'm using TexStudio. I have not much experience using latex so i used an existing template that i got from someone to make my thesis. Indeed i don't know why i need all the packages... I will try to start a new document to see if referencing works there... if it does, than i know at least the problem is in the template ! – Thaïs De Ruyter May 15 '20 at 17:34
  • If you don't have to use the template I suggest you throw it away immediately. Start with a truly minimal setup and load only the packages you need. – moewe May 16 '20 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.