我认为我的代码可能存在问题(因为我对 Latex/overleaf 还很陌生)。请注意,我使用的是 overleaf。我也在其他地方看到过这个问题,但答案对我来说不起作用。有人能发现我的序言中存在重大错误吗?请注意,我现在没有在我的代码中包含其他答案。
需要明确的是:当我在图片标题中引用时,这些内容会首先列在参考书目列表中,与出现顺序无关。如何让它们按出现顺序列出?
\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}
答案1
欢迎来到 tex.stackexchange。您的代码中有几个小问题:
- 这远非最低限度
- 你不应该写,
\bibliography{\jobname.bib}
因为.bib
会自动添加 - 您无需加载,
graphics
因为它已由graphicx
filecontents
只要使用序言中的相关环境,就不需要该包- 正如 @leandriis 所说,如果您想要按外观排序的参考列表,则应使用未排序的样式,其原型是
\bibliographystyle{unsrtnat}
你问题的根源在于\listoffigures
站在起点并调用\cite{Dalheim2016}
到的。
因此你可以:
- 去除
\listoffigures
- 放在最后
- 最后但并非最不重要的是,使用可选参数
\caption
,因为它定义了输入的内容\listoffigures
。当然,这是真正的解决方案。
最小的例子:
%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}
顺便说一句,该unsrtnat
样式不处理 doi、issn 或任何类型或 url。如果需要,您必须找到另一个与 natbib 兼容的、可以与它们配合使用的方法。一个可能的解决方案:添加\usepackage[natbibapa]{apacite}
preable 并使用
\bibliographystyle{apacite}
。apacite 的一个优点是.bbl
文件包含的格式不是硬编码的,而是依赖于您可以轻松自定义的宏\renewcommand
。
`