![我确信我的参考是正确的,但我收到错误包 natbib 警告引用未定义](https://linux22.com/image/467725/%E6%88%91%E7%A1%AE%E4%BF%A1%E6%88%91%E7%9A%84%E5%8F%82%E8%80%83%E6%98%AF%E6%AD%A3%E7%A1%AE%E7%9A%84%EF%BC%8C%E4%BD%86%E6%88%91%E6%94%B6%E5%88%B0%E9%94%99%E8%AF%AF%E5%8C%85%20natbib%20%E8%AD%A6%E5%91%8A%E5%BC%95%E7%94%A8%E6%9C%AA%E5%AE%9A%E4%B9%89%20.png)
这是该部分,无效的引用是 EDEL。
\chapter{Literature Review}
\section{Humpback Whale Biomimicry}
... \cite{Edel1978} ... \cite{Li2020} ...
这是在参考书目文件中条目的定义方式:
@article{Edel1978,
author = {R. K. Edel and H. E. Winn},
doi = {10.1007/BF00397155},
issn = {0025-3162},
issue = {3},
journal = {Marine Biology},
pages = {279-287},
title = {Observations on underwater locomotion and flipper
movement of the humpback whale Megaptera novaeangliae},
volume = {48},
year = {1978},
}
答案1
显示的代码中没有错误,我在每个阶段都显示了终端输出(从您的代码片段中制作出可用示例之后)
dd978.tex
\documentclass{book}
\usepackage{natbib}
\begin{document}
\chapter{Literature Review}
\section{Humpback Whale Biomimicry}
... \cite{Edel1978} ...
\bibliographystyle{plainnat}
\bibliography{xbib}
\end{document}
参考书目
@article{Edel1978,
author = {R. K. Edel and H. E. Winn},
doi = {10.1007/BF00397155},
issn = {0025-3162},
issue = {3},
journal = {Marine Biology},
pages = {279-287},
title = {Observations on underwater locomotion and flipper
movement of the humpback whale Megaptera novaeangliae},
volume = {48},
year = {1978},
}
pdflatex dd978
Package natbib Warning: Citation `Edel1978' on page 1 undefined on input line 9
.
No file dd978.bbl.
Package natbib Warning: There were undefined citations.
bibtex dd978
This is BibTeX, Version 0.99d (TeX Live 2023)
The top-level auxiliary file: dd978.aux
The style file: plainnat.bst
Database file #1: xbib.bib
pdflatex dd978
Package natbib Warning: Citation `Edel1978' on page 1 undefined on input line 9
.
(./dd978.bbl [1{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdfte
x.map}] [2])
Package natbib Warning: There were undefined citations.
[3] (./dd978.aux
Package natbib Warning: Citation(s) may have changed.
(natbib) Rerun to get citations correct.
pdflatex dd978
Output written on dd978.pdf (3 pages, 57128 bytes).
Transcript written on dd978.log.
答案2
你说你想根据 APA6 或 APA7 指南来格式化书目条目。因此,我建议你不是使用natbib
引文管理包。
要获得符合 APA6 指南的格式,请使用引文管理包(如果您希望使用和,apacite
则带有选项)和参考书目样式。(要获得符合 APA7 指南的格式,您需要切换到 biblatex/biber。)natbibapa
\citet
\citep
apacite
并且,请务必再运行 LaTeX、BibTeX 和 LaTeX 两次,以便完全传播任何更改。
\documentclass{article} % or {book}
\begin{filecontents}[overwrite]{xbib.bib}
@article{Edel1978,
author = {R. K. Edel and H. E. Winn},
doi = {10.1007/BF00397155},
issn = {0025-3162},
issue = {3},
journal = {Marine Biology},
pages = {279--287},
title = {Observations on underwater locomotion and flipper
movement of the humpback whale {Megaptera} novaeangliae},
volume = {48},
year = {1978},
}
\end{filecontents}
\usepackage[natbibapa]{apacite}
\bibliographystyle{apacite}
\usepackage{xurl}
\usepackage[colorlinks,allcolors=blue]{hyperref} % optional
\hyphenation{novae-angliae mega-ptera}
\begin{document}
\section{Humpback whale biomimicry}
\dots\ \citet{Edel1978} \dots
\bibliography{xbib}
\end{document}