0

I think there might be something wrong with my code (as I am very new to Latex/overleaf). Note that I am using overleaf. I have seen this question other places too, but the answers are not working for me. Can anyone spot a major mistake in my preamble? Note that I have now not included the other answers in my code.

To be clear: When I cite inside the figure caption, these are listed first in the biblipgraphy list, independent of the order of appearance. How do I make them list in order of appearance?

\documentclass[12pt, twoside]{report}

\usepackage[margin=0.9 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{pgffor} 
\usepackage{float}
\usepackage{graphics} 
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{colortbl}
\usepackage{longtable}
\setlength\LTleft\parindent

\usepackage{siunitx} 
\usepackage{textcomp} 
\usepackage{gensymb} 
\usepackage[version = 4]{mhchem} 


\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{mathptmx}

\usepackage{xcolor}
\usepackage{titlesec}

\usepackage[euler]{textgreek} 

\graphicspath{{Images/}}

\usepackage[font=small]{caption}

\usepackage[numbers,round]{natbib}
\addto\captionsenglish{\renewcommand{\bibname}{References}}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@article{Hannan2013,
author = {Hannan, Nicholas R F and Segeritz, Charis-patricia and Touboul Thomas and Vallier, Ludovic},
doi = {10.1038/nprot.2012.153},
issn = {1754-2189},
journal = {Nat. Protoc.},
month = {feb},
number = {2},
pages = {430--437},
title = {{Production of hepatocyte-like cells from human pluripotent stem cells}},
volume = {8},
year = {2013}
}

@article{Lim1980,
author = {Lim, Franklin and Sun, Anthony M.},
doi = {10.1126/science.6776628},
issn = {00368075},
journal = {Science (80-. ).},
number = {4472},
pages = {908--910},
title = {{Microencapsulated islets as bioartificial endocrine pancreas}},
volume = {210},
year = {1980}
}

@article{Dalheim2016,
author = {Dalheim, Marianne and Vanacker, Julie and Najmi, Maryam A. and Aachmann, Finn L. and Strand, Berit L. and Christensen, Bj{\o}rn E.},
doi = {10.1016/j.biomaterials.2015.11.043},
issn = {18785905},
journal = {Biomaterials},
keywords = {Alginate,Cell adhesion,Periodate oxidation,RGD peptide,Reductive amination,Tissue engineering},
pages = {146--156},
title = {{Efficient functionalization of alginate biomaterials}},
volume = {80},
year = {2016}
}

\end{filecontents*}


\usepackage{color}

% Setting chapter and section format:
\titleformat{\chapter}
  {\normalfont\rmfamily\LARGE\bfseries}
  {\thechapter}{20pt}{\LARGE}
  \titlespacing*{\chapter}{0pt}{-10pt}{14pt} 
 \titleformat{\section}
  {\normalfont\rmfamily\Large\bfseries}
  {\thesection}{1em}{\Large}
 \titleformat{\subsection}
  {\normalfont\rmfamily\large\bfseries}
  {\thesubsection}{1em}{}
 \titleformat{\subsubsection}
  {\normalfont\rmfamily\normalsize\bfseries}
  {\thesubsubsection}{1em}{}

\fancyhf{}
\fancypagestyle{plain}{\fancyhf{}\fancyfoot[LE,RO]{\thepage}\renewcommand{\headrulewidth}{0ex}}

\usepackage{hyperref} 
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

\renewcommand{\figureautorefname}{figure} 
\renewcommand{\tableautorefname}{table} 

%------------DOCUMENT-----------
\pagenumbering{roman}
\begin{document}


% Preface
    \chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface} 
\setcounter{page}{1}


% Table of contents, list of figures, and list of tables
    {\hypersetup{linkcolor=black}
        \tableofcontents
        \listoffigures
        \listoftables
    }

% Background
    \chapter{Background} 
    \pagenumbering{arabic}

% Introduction
    \chapter{Introduction} 
My very first reference \cite{Hannan2013}, 
and my second reference \cite{Lim1980}.

% Methods
    \chapter{Background} 

\begin{figure}[ht]
\centering
\includegraphics[width=3cm]{example-image-a}\qquad
\caption{Periodate oxidation \cite{Dalheim2016}.} % Third reference.
\label{fig:periodateOx}
\end{figure}

% Bibliography
\bibliographystyle{abbrvnat}
\bibliography{\jobname.bib}
    \addcontentsline{toc}{chapter}{References}



\end{document}
  • Can you supply a compilable MWE. As your Example has external files, this cant be compiled. – Sango Sep 24 at 10:17
  • Thank you, I have now edited the document to not include any external files, and it is readily compileable. – Norawww Sep 24 at 11:13
  • Why not use \caption[Periodate oxidation.]{Periodate oxidation \cite{Dalheim2016}.} ? – leandriis Sep 24 at 11:17
  • I have tried that, but it doesn't solve the problem for me. Even if the citation does not appear in the list of figures, it is still numbered as 1 in the caption. – Norawww Sep 24 at 11:20
  • I just had a look at your MWE. The bibliography style that you use sorts the entries in the list of references by last name of first author. (Try to exchange 2 \cite commands and you will see that the references will stay in the same order). To sort by order of appraeance, use unsrtnat as bibliography style instead. – leandriis Sep 24 at 11:25
0

Welcome on tex.stackexchange. There are several small issues in your code:

  1. It is far from being minimal
  2. You should not write \bibliography{\jobname.bib} as the .bib is automatically added
  3. You do not have to load graphics as it is already loaded by graphicx
  4. You don't need the filecontents package as long as you use the related environment in the preamble
  5. As said by @leandriis, if you want a reference list ordered by appearance, you should use an unsorted style, the prototype of whitch is \bibliographystyle{unsrtnat}

The origin of you problem is the \listoffigures which stands at the beginning and calls the \cite{Dalheim2016} to early.

Hence you could:

  1. Remove the \listoffigures
  2. Put it at the end
  3. Last but not least use the optional argument of \caption, as this defines whay is put in \listoffigures. It is of course the real solution.

The minimal example :

%https://tex.stackexchange.com/questions/509567/listing-figure-citations-in-order-of-appearance-in-the-main-bibliography-list-o
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[font=small]{caption}
\usepackage[numbers,round]{natbib}

\begin{filecontents*}{\jobname.bib}
@article{Hannan2013,
author = {Hannan, Nicholas R F and Segeritz, Charis-patricia and Touboul Thomas and Vallier, Ludovic},
doi = {10.1038/nprot.2012.153},
issn = {1754-2189},
journal = {Nat. Protoc.},
month = {feb},
number = {2},
pages = {430--437},
title = {{Production of hepatocyte-like cells from human pluripotent stem cells}},
volume = {8},
year = {2013}
}

@article{Lim1980,
author = {Lim, Franklin and Sun, Anthony M.},
doi = {10.1126/science.6776628},
issn = {00368075},
journal = {Science (80-. ).},
number = {4472},
pages = {908--910},
title = {{Microencapsulated islets as bioartificial endocrine pancreas}},
volume = {210},
year = {1980}
}

@article{Dalheim2016,
author = {Dalheim, Marianne and Vanacker, Julie and Najmi, Maryam A. and Aachmann, Finn L. and Strand, Berit L. and Christensen, Bj{\o}rn E.},
doi = {10.1016/j.biomaterials.2015.11.043},
issn = {18785905},
journal = {Biomaterials},
keywords = {Alginate,Cell adhesion,Periodate oxidation,RGD peptide,Reductive amination,Tissue engineering},
pages = {146--156},
title = {{Efficient functionalization of alginate biomaterials}},
volume = {80},
year = {2016}
}
\end{filecontents*}

\usepackage{hyperref} 
\hypersetup{colorlinks}
%------------DOCUMENT-----------
\begin{document}
{\hypersetup{linkcolor=black}
\tableofcontents
\listoffigures
\listoftables
}

\chapter{Introduction} 
My very first reference \cite{Hannan2013}, 
and my second reference \cite{Lim1980}.

\chapter{Methods} 
\begin{figure}[ht]
\centering
\includegraphics[width=3cm]{example-image-a}\qquad
\caption[Periodate oxidation (from Dalheim2016)]%
{Periodate oxidation \cite{Dalheim2016}.} 
\label{fig:periodateOx}
\end{figure}

\bibliographystyle{unsrtnat}
\bibliography{\jobname}

\end{document}

By the way, the unsrtnat style does not handle neither doi nor issn nor any kind or url. You will have to find another natbib-compatible which works with them, if you need. A possible solution : add \usepackage[natbibapa]{apacite}in preable ans use \bibliographystyle{apacite}. An advantage of apacite is that the .bbl file contains formatting which is not hard-codded but relies on macros that you can easily customize with \renewcommand.

`

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.