Latex/Miktex: Undefined citations

15,483

I have not any problems with this LaTeX code (even if I use a Mac): there are anyway a couple of problems within your code:

  • The title is given as \title[Title of Document] and not as \title{Title of Document}
  • There are 2 \begin{document}: I do not know if this is just a typo when you copied your code here

Are you sure that the path of your .bib file is correct? I suggest to write just \bibliography{library} and put the library.bib file in the same directory of the tex file on which you are working on.

Moreover, have a look also at https://tex.stackexchange.com/ for questions about Tex, LaTeX.

EDIT: Make sure that you are compling your tex files with

  • pdflatex (or latex)
  • bibtex
  • pdflatex (or latex)
  • pdflatex (or latex)

Share:
15,483
Marjanne
Author by

Marjanne

Updated on June 26, 2022

Comments

  • Marjanne
    Marjanne almost 2 years

    I am writing a latex script for my work, and I am having infinite trouble in getting the references in the PDF. My code is shown below, and I am using MikTex 2.9 on RStudio. Some background information that might be relevant:

    • I am using Mendeley for my references, which I have set up correctly (as it seems) to Enable bibtex syncing
    • The .bib file doesn't seem to look strange to me (Irungu is added below)
    • I am using the exact same script as my colleagues (apart from the different path referring to my articles), and they are having no issues compiling it into pdf.
    • The errors regarding citations are: Citation Draganovic2013 on page 1 undefined on input line xx Citation Irungu2019 on page 1 undefined on input line xx There were undefined citations

    I hope one of you is able to help me out! Cheers!

    @article{Irungu2019,
    abstract = {A composite blend consisting of sunflower cake, maize germ, wheat bran, fresh water shrimps and cassava flour was extruded using a single-screw extruder to produce expanded fish feed pellets. The effects of temperature (80–120 °C), die diameter (2–4 mm), and feed pre-conditioning time (50–150 s; steam 400 kPa) on properties of the pellets (expansion ratio, bulk density, floatability, durability, water absorption, water solubility, water stability, and in-vitro protein digestibility) were investigated using response surface methodology. Regression equations describing the effect of each variable on the product responses were obtained. The pellets extruded using a factor combination of 120 °C extruder barrel temperature, 2 mm die diameter, and 100 s of feed pre-conditioning time gave most desirable pellet floatability (100{\%}), durability index (99{\%}), expansion ratio (2.64), water absorption index (4.12), water solubility index (9.31), water stability (87{\%}), bulk density (479 g/L), and in vitro protein digestibility (69.97{\%}) with a composite desirability of 0.88. Practical applications: Extrusion is a modern feed processing method whose use is fast gaining popularity among small feed processors in developing countries. However, extrusion is a process that involves many parameters that need to be optimized for desirable end properties. These findings guide fish feed manufacturers on the optimum conditions for single screw extruders for production of feeds with desirable properties especially for the fish types that are top feeders. In addition, the results offer important insights on how temperature, die diameter, and feed pre-conditioning, may be manipulated to influence properties of extruded aquafeed when using simple low-cost small-scale extruders.},
    author = {Irungu, Francis Gichuho and Mutungi, Christopher and Faraj, Abdul and Affognon, Hippolyte and Ekesi, Sunday and Nakimbugwe, Dorothy and Fiaboe, Komi K.M.},
    doi = {10.1111/jfpe.12980},
    file = {:L$\backslash$:/Marjanne/ScientificArticles/Irungu2019.pdf:pdf},
    issn = {17454530},
    journal = {Journal of Food Process Engineering},
    number = {2},
    pages = {1--12},
    title = {{Optimization of extruder cooking conditions for the manufacture of fish feeds using response surface methodology}},
    volume = {42},
    year = {2019}
    }
    
    \documentclass[10pt,a4paper]{article}
    \usepackage{etoolbox}
    \usepackage{mathpazo}
    \renewcommand{\sfdefault}{lmss}
    \renewcommand{\ttdefault}{lmtt}
    \usepackage{geometry}
    \usepackage[usenames,dvipsnames]{xcolor}
    % \geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2.5cm,rmargin=2.5cm}
    \geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2.5cm,rmargin=2.5cm}
    \usepackage[margin=10pt,font=small,labelfont=bf,labelsep=colon]{caption}
    \usepackage{amstext}
    %% \usepackage{esint}
    \usepackage[english]{babel}
    \usepackage{eurosym}
    \usepackage{booktabs}
    \usepackage[parfill]{parskip}
    \usepackage[round]{natbib}
    %\usepackage{caption}
    \usepackage{pdfpages}
    \usepackage[figuresright]{rotating}
    \usepackage{longtable}
    \usepackage[version=4]{mhchem}
    \usepackage{todonotes}
    \usepackage{hyperref}
    \usepackage{subfig}
    \usepackage{array}
    \usepackage{float}
    \usepackage{lipsum}
    \usepackage{lastpage}
    \usetikzlibrary{patterns}
    \usetikzlibrary{shapes.geometric}
    \usepackage{textcomp}
    
    
    \begin{document}
    
    
    \title[Title of Document]
    
    \begin{document}
    
    \begin{titlepage}
    \maketitle
    \end{titlepage}
    
    \section {Introduction}
    Introduction is written here, but not relevant for this question.
    
    
    \section {Background} 
    Here I write some text and refer to an article of Draganovic from 2013 \citep{Draganovic2013}. \\
    In another section, I would like to refer to Irungu from 2019 \citep{Irungu2019}.\\
    Current project will investigate the possibilities to re-evaluate Sustainable Fiber Technology's Wheat Straw Co-Product, by using it as a (partial) replacement of wheat gluten and/or starch in aquafeed. Being relatively high in lignin (20 - 40\% based on 30 - 50\% solids), the product is a potential excellent binder.
    
    \section {Rest of the document}
    
    Doesn't pose any significant errors.
    
     \bibliographystyle{plainnat}
     \bibliography{C://Users/Marjanne/Documents/April8/library}
    
    
    
    
    \end{document}
    
  • Marjanne
    Marjanne about 4 years
    Hi Eddymage, thanks for your reply! It's indeed strange that others (like you and my colleagues) are able to run the script, while I can't run anything with references/libraries in it... As you recommended, I changed the Title section and removed the typo of begin document, but it still didn't work... Neither did your suggestion of changing the path :( Do you have any clue if there might be an error in the configuration of my MikTex? Thanks!
  • Eddymage
    Eddymage about 4 years
    Dear @Marjanne, are you compiling with PdfLatex -> BibLatex -> PdfLatex -> PdfLatex ? I mean, you have to compile your text file with pdflatex, then you have to run biblatex and then pdlatex again, twice.
  • Marjanne
    Marjanne about 4 years
    Hi @Eddymage, thanks again! I have seen your proposed solution before, but honestly speaking I wouldn't know how to start this sequence using MikTex in Rstudio... I have the option Compile PDF, which I can also run for my tex file, but I am puzzled about how to run BibLatex. Do you have an idea?
  • Eddymage
    Eddymage about 4 years
    Actually I do not use Rstudio, but I found this, maybe it could help: support.rstudio.com/hc/en-us/articles/… . My suggestion is to use another editor to compile tex files (e.g. TexMaker). Do your collegues use Rstudio too to compile tex files?
  • Marjanne
    Marjanne about 4 years
    Unfortunately (for me in this case), they do use RStudio... The strange thing is that they can run my script (just like you could) and run their own scripts, but I am not able to run any script with references in it, also not one of them which they can run without issues...
  • Marjanne
    Marjanne about 4 years
    I'll try figuring it out using TexMaker :)
  • Marjanne
    Marjanne about 4 years
    Hi @Eddymage, you are, without any doubt, today's hero, or let's make it this week's hero! Your suggestion of using TexMaker solved my issue within one minute, after yesterday's full day of swearing ;)
  • Eddymage
    Eddymage about 4 years
    Dear @Marjanne, I am glad to help! I know that Rstudio has some builtin functions for compiling latex files, but looking among various websites seems quite difficult to include bibliography commands. Maybe you may have also a look at the set up of your collegues' Rstudio, while using TexMaker (which again I strongly suggest! :-) )
  • samcarter_is_at_topanswers.xyz
    samcarter_is_at_topanswers.xyz almost 3 years
    The OP is NOT using biblatex. Your workflow won't work for a traditional bibtex document.