我正在写论文,并从我的研究所获得了一个自定义的 LaTeX 模板。它有自己的文档类和一个 main.tex 文件。我的问题是,我试图将 .cls 文件中的引用样式更改为 APA,但当我使用该\cite
命令时,它显示错误并且没有链接到参考书目。事实上,它根本没有创建条目。如果它有相关性,我正在使用 TexMaker 作为编辑器。
这是我在.cls文件中的相关代码:
% Configuration of Bibliography (General) ------------------------
% Load the csquotes package for nice quotation symbols
% (recommended by biblatex)
\RequirePackage[autostyle=true]{csquotes}
% Loads the biblatex package for citations
\RequirePackage[
% Use the newest backend: biber
backend=biber,
% Use alphabetic style
style=apa,
% Add an entry to the ToC
bibtotoc
]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
为了以防万一,这里是 .bib 文件中的条目:
@article{sitaram_closed-loop_2017,
title = {Closed-loop brain training: the science of neurofeedback},
volume = {18},
issn = {1471-003X, 1471-0048},
shorttitle = {Closed-loop brain training},
url = {http://www.nature.com/articles/nrn.2016.164},
doi = {10.1038/nrn.2016.164},
language = {en},
number = {2},
urldate = {2022-03-17},
journal = {Nature Reviews Neuroscience},
author = {Sitaram, Ranganatha and Ros, Tomas and Stoeckel, Luke and Haller, Sven and Scharnowski, Frank and Lewis-Peacock, Jarrod and Weiskopf, Nikolaus and Blefari, Maria Laura and Rana, Mohit and Oblak, Ethan and Birbaumer, Niels and Sulzer, James},
month = feb,
year = {2017},
pages = {86--100},
file = {Eingereichte Version:files/8/Sitaram et al. - 2017 - Closed-loop brain training the science of neurofe.pdf:application/pdf},
}
以下是我的引用方式:
\cite[]{sitaram_closed-loop_2017}
我当然也会在 main.tex 文件中打印参考书目:
\printbibliography[
heading=bibintoc,
titel{Bibliography}
]
%An additional problem here is, that it doesn't actually create an
%entry in my table of contents, so maybe someone could help here too.
它是这样显示的:
sitaram_closed-loop_2017
我将非常感谢您的帮助,并欢迎向我询问更多信息。
答案1
bibtotoc
不是一个选项biblatex
识别。所以
\RequirePackage[
% Use the newest backend: biber
backend=biber,
% Use alphabetic style
style=apa,
% Add an entry to the ToC
bibtotoc
]{biblatex}
将会出错,应更正为
\RequirePackage[
backend=biber,
style=apa,
]{biblatex}
此外titel{Bibliography}
\printbibliography[
heading=bibintoc,
titel{Bibliography}
]
看起来像是拼写错误title={Bibliography}
,所以你可能需要
\printbibliography[
heading=bibintoc,
title={Bibliography}
]
修复这两个问题后,示例如下
\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[
backend=biber,
style=apa,
]{biblatex}
\begin{filecontents}{\jobname.bib}
@article{sitaram_closed-loop_2017,
title = {Closed-loop brain training},
subtitle = {the science of neurofeedback},
volume = {18},
issn = {1471-003X, 1471-0048},
url = {http://www.nature.com/articles/nrn.2016.164},
doi = {10.1038/nrn.2016.164},
language = {en},
number = {2},
urldate = {2022-03-17},
journal = {Nature Reviews Neuroscience},
author = {Sitaram, Ranganatha and Ros, Tomas and Stoeckel, Luke
and Haller, Sven and Scharnowski, Frank
and Lewis-Peacock, Jarrod and Weiskopf, Nikolaus
and Blefari, Maria Laura and Rana, Mohit
and Oblak, Ethan and Birbaumer, Niels and Sulzer, James},
month = feb,
year = {2017},
pages = {86--100},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\tableofcontents
\section{Lorem}
\autocite{sitaram_closed-loop_2017}
\printbibliography[
heading=bibintoc,
title={Bibliography}
]
\end{document}
对我来说编译得很好
即使具有所需的 ToC 条目。
请注意,您需要使用 LaTeX、Biber、LaTeX、LaTeX 编译此文档(其中“LaTeX”可以是您最喜欢的 LaTeX 风格,在本例中为 pdfLaTeX)。您可能需要配置您的编辑器来运行 BiberBiblatex 与 Biber:配置我的编辑器以避免未定义的引用。 (使用问号或粗体引用关键字代替引用编号解释了为什么我们首先需要运行 Biber。
请注意,除非您的系统很旧,否则您不需要\DeclareLanguageMapping{american}{american-apa}
(在这种情况下您甚至无法从中获得当前的第 7 版 APA 样式biblatex-apa
)。