我对 LateX 还很陌生,曾尝试使用 Overleaf 以多种方式为我的论文进行 APA 引用(作者、年份),但都没有成功。我使用以下模板:
https://de.overleaf.com/latex/templates/tut-slash-ttu-thesis-template/fczbvgdpbjtf
包含所有参考文献的文档名为 library.bib
@article{Pelczar2016,
title = {{A pathogenic role for T cell–derived IL-22BP in inflammatory bowel disease}},
year = {2016},
journal = {Science},
author = {Pelczar, Penelope and Witkowski, Mario and Perez, Laura Garcia and Kempski, Jan and Hammel, Anna G and Brockmann, Leonie and Kleinschmidt, Dörte and Wende, Sandra and Haueis, Cathleen and Bedke, Tanja and Witkowski, Marco and Krasemann, Susanne and Steurer, Stefan and Booth, Carmen J and Busch, Philipp and K{\"{o}}nig, Alexandra and Rauch, Ursula and Benten, Daniel and Izbicki, Jakob R and R{\"{o}}sch, Thomas and Lohse, Ansgar W and Strowig, Till and Gagliani, Nicola and Flavell, Richard A and Huber, Samuel},
number = {6310},
month = {10},
pages = {358 LP - 362},
volume = {354},
url = {http://science.sciencemag.org/content/354/6310/358.abstract},
doi = {10.1126/science.aah5903}
这是文档的一部分:
\documentclass[12pt, a4paper]{report}
\usepackage{thesis}
\usepackage[apacite]
\begin{document}
...
\cite{Sato2013}
\cite{Pelzcar2016}
...
\bibliographystyle{apacite}
\bibliography{library}
\end{document}
但是,我只收到错误:
'\bibliographystyle' invalid. \bibliographystyle'
'can be used only in preamble. \bibliography'
我还使用以下命令尝试了不同的引用样式:
\usepackage[style=apa, backend=biber]{biblatex}
\addbibresource{library.bib}
...
\printbibliography
Option clash for package biblatex
但 后来我得到了错误:Citation undefined on line xx
如能得到任何帮助我将非常感激!
答案1
apacite
使用引文管理包和相关的参考书目样式时,您的测试文档无法编译,apacite
因为它包含两个错误 - 一个语法错误,一个相应的拼写错误。
必须使用花括号(而不是方括号)来表示 LaTeX 指令的参数。因此,写为
\usepackage{apacite}
,不是\usepackage[apacite]
。的参数
\cite
必须与 bib 文件中的条目相对应。由于条目的键是Pelczar2016
,因此引用命令必须是\cite{Pelczar2016}
,不是\cite{Pelzcar2016}
。
在进行必要的调整后,测试文档就可以编译了。
附录:如果您想使用biblatex
包而不是包,apacite6
同时遵守 APA 手册第 6 版的格式指南,以显示参考书目和引文标注,则应更改说明
\usepackage{apacite}
\bibliographystyle{apacite}
到
\usepackage[style=apa6]{biblatex}
\addbibresource{library.bib}
在前言中将 改为 ,在正文中改为 。并且,务必使用\bibliography{library}
而不是作为后台程序。\printbibliography
biber
bibtex
顺便说一句,如果你想关注最新版本——不再是 APA 格式指南的第 6 版,而是第 7 版,您应该将其更改[style=apa6]
为[style=apa]
。APA7 带来的一个显而易见的变化是,只有当条目中有超过 20 位作者时,作者列表才会被截断;在 APA6 下,截断截止点设置为 8。
\documentclass[12pt, a4paper]{article} % using 'article' just for this MWE
\begin{filecontents}[overwrite]{library.bib}
@article{Pelczar2016,
title = {{A pathogenic role for T cell–derived IL-22BP in inflammatory bowel disease}},
year = {2016},
journal = {Science},
author = {Pelczar, Penelope and Witkowski, Mario and Perez, Laura Garcia and Kempski, Jan and Hammel, Anna G and Brockmann, Leonie and Kleinschmidt, Dörte and Wende, Sandra and Haueis, Cathleen and Bedke, Tanja and Witkowski, Marco and Krasemann, Susanne and Steurer, Stefan and Booth, Carmen J and Busch, Philipp and König, Alexandra and Rauch, Ursula and Benten, Daniel and Izbicki, Jakob R and Rösch, Thomas and Lohse, Ansgar W. and Strowig, Till and Gagliani, Nicola and Flavell, Richard A. and Huber, Samuel},
number = {6310},
month = {10},
pages = {358 LP--362},
volume = {354},
url = {http://science.sciencemag.org/content/354/6310/358.abstract},
doi = {10.1126/science.aah5903},
}
\end{filecontents}
%\usepackage{thesis} % I don't have this style file
\usepackage[T1]{fontenc}
\usepackage{apacite}
\bibliographystyle{apacite}
\usepackage{xurl} % optional -- allow line breaks at arbritary points in long URL strings
\begin{document}
\cite{Pelczar2016} % not 'Pelzcar2016'
\bibliography{library}
\end{document}