错误:类 apa6:未指定参考书目包;引用未定义

错误:类 apa6:未指定参考书目包;引用未定义

嘿呀!

我是一名超级初学者,我尝试用 apa 格式写作业,为此我下载了 apa6 和 apacite。但是,我似乎无法使引用起作用。没有参考书目,文中引用显示为“(?, ?)”,我真的不知道我做错了什么,我在这些论坛和其他人那里找到的任何东西都无法解决这个问题(我已经尝试了 pdflatex-bibtex-pdflatex(2x) 序列,这是 Texmaker 中的标准,并且有大量添加或删除部分代码的变体)。我想我可能真的不知道这一切在 latex 中是如何工作的。

我正在使用 Windows 10、MiKTeX 和 texmaker。

为了测试这一切,我创建了这个示例模板来了解哪些部分不起作用。

\documentclass[a4paper,man,british]{apa6}

\usepackage[british]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{apacite}
\usepackage{ragged2e}
\justifying


\bibliographystyle{apacite}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{Long Sample Banana Title : How APA can be used for your Banana Article}
\shorttitle{Short Sample Banana Title}
\author{Mr Bananaman}
\affiliation{Some banana university}

\abstract{About bananas}
\keywords{banana, love}

\begin{document}
\maketitle

Things are often bananas.

\section{Bananas: A declaration of love}
Banana banana banana banana \cite{ex25-t1}

\subsection{Bananas are yellow}
Banana banana banana. \citeA{bananacite} banana.

\subsection{They taste heavenly}
Banana banana \citeyear{bananacite}.

\section{Conclusion}
Bananas are everything.

\bibliography{bananarefs}
\end{document}

使用这个bananarefs.bib文件:

@Article{bananacite,
author = {banana man},
title = {banana test citation},
journal = {banana publishing},
year = {2023},
}

@book{ex25-t1,
  author         = {Vygotsky, L. S.},
  year           = {1978},
  title          = {Mind in Society: {T}he Development of Higher Mental
                    Processes},
  editor         = {Rice, Edgar},
  address        = {Cambridge, MA},
  publisher      = {Harvard University Press},
}

给出了以下错误:

...
Class apa6 Info: No bibliography package was specified; defaulting to (but not
loading) Biblatex on input line 213

...
LaTeX Warning: Citation `ex25-t1' undefined on input line 33.
No file "apa test".bbl

再次,pdf 中的 apa 样式一切都很好,只有引用显示为“(?, ?)”或“? (?)”,具体取决于我在文中的引用,最后没有参考列表。

我希望有人了解出了什么问题并启发我。

答案1

  • apa6 类比较特殊,apacite它不加载包,而是有一个文档类选项。这也会处理样式,所以\bibliographystyle{...}没有必要。

  • \bibliography{bananarefs}不见了


\documentclass[a4paper,man,british,apacite]{apa6}

\usepackage[british]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
%\usepackage{apacite}
\usepackage{ragged2e}
\justifying

%\bibliographystyle{apacite}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{Long Sample Banana Title : How APA can be used for your Banana Article}
\shorttitle{Short Sample Banana Title}
\author{Mr Bananaman}
\affiliation{Some banana university}

\abstract{About bananas}
\keywords{banana, love}

\begin{document}
\maketitle

Things are often bananas.

\section{Bananas: A declaration of love}
Banana banana banana banana \cite{ex25-t1}
\bibliography{bananarefs}

\end{document}

在此处输入图片描述

答案2

我建议您查阅一下手册apa6并看看例子。

具体来说:删除apacite并改用 biblatex。使用\textcite\parencite作为引用命令。最后使用以下命令打印参考书目\printbibliography

\documentclass[a4paper,man,british]{apa6}
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
%\usepackage{apacite}
\usepackage{ragged2e}
\justifying

\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{bananarefs.bib}
%\bibliographystyle{apacite}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{Long Sample Banana Title : How APA can be used for your Banana Article}
\shorttitle{Short Sample Banana Title}
\author{Mr Bananaman}
\affiliation{Some banana university}

\abstract{About bananas}
\keywords{banana, love}

\begin{document}
\maketitle

Things are often bananas.

\section{Bananas: A declaration of love}
Banana banana banana banana \textcite{ex25-t1}

\subsection{Bananas are yellow}
Banana banana banana. \parencite{bananacite} banana.

\subsection{They taste heavenly}
Banana banana \citeyear{bananacite}.

\section{Conclusion}
Bananas are everything.

%\bibliography{bananarefs}
\printbibliography
\end{document}

如果仍有问题,请尝试从 shell 运行它:pdflatex yourfile.tex。如果引用未定义,请运行biber yourfile.bcf然后再次运行 pdflatex。(请注意,这些是针对 GNU/Linux 的说明,它们不适用于 Windows。)

相关内容