无法在 Overleaf 中显示编号的参考书目和引文

无法在 Overleaf 中显示编号的参考书目和引文

不幸的是,我的论文在 Overleaf 上没有按数字列出每个来源的参考书目和引文。我使用这个natbib软件包。我知道还有另一个bibtex用于参考书目的软件包,但它没有与这个utf8x软件包一起编译,我必须使用它才能编写我的论文。

我使用的代码:

\documentclass[12pt,a4paper,oneside,onecolumn]{report}
\usepackage{libertine}
\usepackage{courier}
\usepackage{braket}
\usepackage[utf8x]{inputenc}
\usepackage{natbib}
\setcitestyle{square,numbers ,comma ,sort&compress, super} 
\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{float}
\usepackage{amsmath}
\usepackage{mathpazo}
\usepackage{datetime}
\graphicspath{ {images/} }
\usepackage[T1]{fontenc}
\usepackage[hebrew,english]{babel}
\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
    % Useful packages
\usepackage[colorlinks=true, allcolors=blue]{hyperref}


 \begin{document}

 Some text. \cite{ADSCFT,Bethe} Another citation. \cite{BM}


\bibliographystyle{unsrtnat}
\bibliography{../sample.bib}

\end{document}

该文件sample.bib由以下方式提供:

    @article{ADSCFT,
    doi = {10.1007/s11005-011-0516-7},
    url = {https://doi.org/10.1007%2Fs11005-011-0516-7},
    year = 2011,
    month = {aug},
    publisher = {Springer Science and Business Media {LLC}
},
    volume = {99},
    number = {1-3},
    pages = {425--453},
    author = {Gregory P. Korchemsky},
    title = {Review of {AdS}/{CFT} Integrability, Chapter {IV}.4: Integrability in {QCD} and {\textdollar}{\textdollar}$\lbrace${\textbackslash}fancyscript$\lbrace$N$\rbrace$ {\&}lt$\mathsemicolon$4 $\rbrace${\textdollar}{\textdollar} {SYM}},
    journal = {Letters in Mathematical Physics}
}

@article{Bethe,
  title={Zur Theorie der Metalle},
  author={Hans A. Bethe},
  journal={Zeitschrift f{\"u}r Physik},
  year={1931},
  volume={71},
  pages={205-226}
}

@book{BM,
    author    = "Bill Sutherland",
    title     = "Beautiful Models: 70 Years of Exactly Solved Quantum Many-Body Problems",
    year      = "2004",
    publisher = "World Scientific",
 }

但是参考书目的输出如下: 在此处输入图片描述

numbers我们可以看到,虽然我在usepackage 部分添加了编号,但是源并没有被编号natbib

编辑:

我不知道为什么,但是当我改变包插入的顺序时,我的文件在 Overleaf 中被编译为编号。我没有写入上述插入,而是写入:

\documentclass[12pt,a4paper,oneside,onecolumn]{report}
\usepackage{libertine}
\usepackage{courier}
\usepackage[utf8x]{inputenc}
\usepackage[hebrew,english]{babel}
\usepackage[longnamesfirst,square,numbers,comma,sort&compress]{natbib}
\usepackage{titlesec}
\usepackage{float}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{mathpazo}
\usepackage{datetime}
\graphicspath{ {images/} }
\usepackage[T1]{fontenc}
\usepackage{braket}
\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt}
 \usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}   
   \usepackage[colorlinks=true, allcolors=blue]{hyperref}

答案1

我不确定您是否需要该natbib软件包。无论如何,\bibliographystyle{unsrt}对我来说使用效果很好。这是一个最小示例(请注意文件的路径.bib):

\documentclass[12pt,a4paper,oneside,onecolumn]{report}
\usepackage[T1]{fontenc}
\usepackage[hebrew,english]{babel}
\usepackage{lipsum} %generate text

\begin{document}
    \chapter{Introduction} \label{intro}
    \lipsum[1-1] \cite{argall2011teacher}
    \lipsum[1-1] \cite{li2018oil}
    
    \bibliographystyle{unsrt}
    \bibliography{../biblio.bib}
\end{document}

顺便说一句,当发布问题时,请尝试制作不需要特定文件即可编译的最少示例;)

答案2

像这样吗?

在此处输入图片描述

装载时将其放入square,numbers, comma ,sort&compress, super方形支架中natbib\usepackage[square,numbers, comma ,sort&compress, super]{natbib}

以下是 MWE:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[square,numbers, comma ,sort&compress, super]{natbib}
\bibliographystyle{abbrvnat}


\begin{document}

some text. \cite{einstein}. Another citation. \cite{latexcompanion,einstein}
Final citation \cite{latexcompanion,knuthwebsite}

\medskip

\bibliography{sample}

\end{document}

文件如下sample.bib

@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
        [{On} the electrodynamics of moving bodies]",
    journal =      "Annalen der Physik",
    volume =       "322",
    number =       "10",
    pages =        "891--921",
    year =         "1905",
    DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}

@book{latexcompanion,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The \LaTeX\ Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}

@misc{knuthwebsite,
    author    = "Donald Knuth",
    title     = "Knuth: Computers and Typesetting",
    url       = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}

我知道还有另一个用于参考书目的 bibtex 包

你知道还有第三个选项吗biblatex?我使用这个,因为它比 有更多的引用样式natbib。但是,我不知道它是否适用于\usepackage[utf8x]{inputenc}

答案3

我尝试使用biblatex库。这是 MWE:

\documentclass[12pt,a4paper,oneside,onecolumn]{report}
\usepackage{libertine}
\usepackage{courier}
\usepackage{braket}
\usepackage[utf8]{inputenc}
\usepackage[style=chem-angew]{biblatex}
\addbibresource{sample.bib}

%\usepackage[square,numbers, comma ,sort&compress, super]{natbib}

\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{float}
\usepackage{amsmath}
\usepackage{mathpazo}
\usepackage{datetime}
\graphicspath{ {images/} }
\usepackage[T1]{fontenc}
\usepackage[hebrew,english]{babel}
\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt}
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
    % Useful packages
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

\begin{document}

some text. \cite{einstein}. Another citation. \supercite{latexcompanion,einstein}
Final citation \supercite{latexcompanion,knuthwebsite}

\printbibliography
%\bibliography{sample}

\end{document}

在此处输入图片描述 在此处输入图片描述

你需要改变的是:

  • \usepackage[style=chem-angew]{biblatex}在此添加之后立即添加
  • \addbibresource{references.bib}代替
  • \bibliography{references.bib}\printbibliography而不是
  • \cite使用\supercite

相关内容