![添加多个引文时添加问号](https://linux22.com/image/450384/%E6%B7%BB%E5%8A%A0%E5%A4%9A%E4%B8%AA%E5%BC%95%E6%96%87%E6%97%B6%E6%B7%BB%E5%8A%A0%E9%97%AE%E5%8F%B7.png)
我正在写一份报告,需要添加文献引用。当我在整个正文中添加多个引用时,只有一个引用正确显示,其他的都变成了 (?,?)。
这是我的 Overleaf 包
\documentclass[12pt, oneside]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{array}
\usepackage{amssymb}
\usepackage[font=small,skip=-10pt]{caption}
\usepackage{subcaption}
\usepackage[a4paper, inner=1.5cm, outer=1.5cm, top=2.3cm, bottom=2.3cm]{geometry}
\usepackage{newtxtext,newtxmath,amsmath}
\usepackage{apacite}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{threeparttable}
\usepackage{setspace}
\usepackage[table,xcdraw]{xcolor}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\usepackage{ulem}
以下是我在正文中引用论文的方法
This is a cool citation \cite{sirin_socioeconomic_2005} and this is another cool citation \cite{angrist_perils_2014}
.bib 文件中的引文如下所示
@article{angrist_perils_2014,
title = {The {Perils} of {Peer} {Effects}},
volume = {30},
url = {https://www.researchgate.net/publication/263319266_The_Perils_of_Peer_Effects},
doi = {10.1016/j.labeco.2014.05.008},
urldate = {2021-02-10},
journal = {Labour Economics},
author = {Angrist, Joshua},
year = {2014},
file = {Full Text:C\:\\Users\\User\\Zotero\\storage\\4UIR33RD\\Angrist - 2014 - The Perils of Peer Effects.pdf:application/pdf},
}
@article{sirin_socioeconomic_2005,
title = {Socioeconomic {Status} and {Academic} {Achievement}: {A} {Meta}-{Analytic} {Review} of {Research}},
volume = {75},
issn = {0034-6543},
shorttitle = {Socioeconomic {Status} and {Academic} {Achievement}},
url = {https://doi.org/10.3102/00346543075003417},
doi = {10.3102/00346543075003417},
language = {en},
number = {3},
urldate = {2022-05-23},
journal = {Review of Educational Research},
author = {Sirin, Selcuk R.},
month = sep,
year = {2005},
note = {Publisher: American Educational Research Association},
keywords = {achievement, meta-analysis, SES, social class, socioeconomic status},
pages = {417--453},
}
以下是我在 main.tex 末尾调用参考书目的方法
\bibliographystyle{apacite}
\bibliography{Thesis.bib}
我确保.bib 文件确实名为 Thesis.bib,事实上我知道它是正确的,因为当我只添加一个引用时,它既正确地出现在我调用它的正文中,也正确地出现在文档的底部。
此外,我还看到了两条错误消息。一条位于我引用参考文献的旁边,内容如下:
Citation '...' undefined on line N
在 \bibliography{Thesis.bib} 旁边还有一个,内容是:
runaway argument ?
我已经这样做过几十次了,从来没有遇到过这样的问题。
MWE 在评论中问道:
\documentclass[12pt, oneside]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{array}
\usepackage{amssymb}
\usepackage[font=small,skip=-10pt]{caption}
\usepackage{subcaption}
\usepackage[a4paper, inner=1.5cm, outer=1.5cm, top=2.3cm, bottom=2.3cm]{geometry}
\usepackage{newtxtext,newtxmath,amsmath}
\usepackage{apacite}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{threeparttable}
\usepackage{setspace}
\usepackage[table,xcdraw]{xcolor}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\usepackage{ulem}
\graphicspath{ {./Images/} }
\setstretch{1.25}
\begin{document}
\section{Introduction}
This is a cool citation \cite{sirin_socioeconomic_2005} and this is another cool citation \cite{angrist_perils_2014}
\clearpage
\bibliographystyle{apacite}
\bibliography{Thesis.bib}
\end{document}
编辑:我还注意到 \end{document} 旁边的最后一个错误消息:
LaTeX Error: \begin{thebibliography} on input line 1 ended by \end{document}
答案1
我可以重现一些类似的错误
Runaway argument?
{\check@icl Labour Economics\check@icr \expandafter \egroup \fi \ifx \ETC.
! File ended while scanning use of \UL@on.
进而
! LaTeX Error: \begin{thebibliography} on input line 1 ended by \end{document}.
使用以下 MWE
\documentclass[12pt, oneside]{article}
\usepackage[T1]{fontenc}
\usepackage{apacite}
\usepackage{ulem}
\begin{filecontents}{\jobname.bib}
@article{angrist_perils_2014,
author = {Angrist, Joshua},
title = {The Perils of Peer Effects},
year = {2014},
journal = {Labour Economics},
volume = {30},
doi = {10.1016/j.labeco.2014.05.008},
}
@article{sirin_socioeconomic_2005,
author = {Sirin, Selcuk R.},
title = {Socioeconomic Status and Academic Achievement:
A Meta-Analytic Review of Research},
shorttitle = {Socioeconomic Status and Academic Achievement},
journal = {Review of Educational Research},
year = {2005},
month = sep,
volume = {75},
issn = {0034-6543},
doi = {10.3102/00346543075003417},
language = {en},
number = {3},
pages = {417--453},
}
\end{filecontents}
\begin{document}
This is a cool citation \cite{sirin_socioeconomic_2005}
and this is another cool citation \cite{angrist_perils_2014}
\bibliographystyle{apacite}
\bibliography{\jobname}
\end{document}
这里的问题是
\usepackage{ulem}
ulem
将传统\emph
命令转换为应用下划线的命令。此下划线命令对它接受的输入相当挑剔。印刷下划线通常不被鼓励,所以最好ulem
彻底摆脱它。
如果您需要在文档的其他位置添加下划线,则有更好的解决方案(https://tex.stackexchange.com/a/446488/35864ulem
),但如果您使用该选项加载它,您甚至可以继续,normalem
因此它会保持\emph
不变。
\usepackage[normalem]{ulem}
您的文档也将受益于加载或\usepackage{url}
,\usepackage{hyperref}
以便 URL 得到良好处理。(如果您不加载这两个包,_
URL 中的特殊字符可能会出错。)
您可能还想查看一下您加载的其他包。如果您不需要它们,通常最好不要加载包。这样可以使代码更易于维护,并避免出现类似这样的意外。
还要注意,你应该只加载一次包。如果你用不同的选项多次加载包,甚至可能会出错。