错误:存在未定义的引用

错误:存在未定义的引用

我在生成参考书目时遇到了麻烦。我正在使用 Mendeley 来生成.bib文件。以前我使用相同的流程,它工作得非常准确,但现在不行了。每当我尝试编译我的文档时,它都会不断说有未定义的引用,尽管我通过\citep{}在文本下使用 . 很好地将其放在引文中,它工作正常,但最后没有生成参考书目。我使用的代码如下

\documentclass[a4paper,twoside,openright,12pt]{book}

\usepackage[T1]{fontenc}

\usepackage{newtxtext}

\usepackage[utf8]{inputenc}

\usepackage[english]{babel}

\usepackage{csquotes}

\usepackage{amsthm}

\usepackage{amsmath}

\usepackage{mathptmx}

\usepackage{mathrsfs}

\usepackage{textcomp}

\usepackage{textgreek}
 
\usepackage{float}
\restylefloat{table}


\usepackage{url}
 
\usepackage[natbib=true, backend=biber,style=apa]{biblatex}

\addbibresource{library.bib}

 
\usepackage[final]{graphicx}

\graphicspath{{Figures/}}


\usepackage{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm,headheight=0cm,headsep=0cm,footskip=0cm,
    nomarginpar % <-- comment out this option to see the difference
} 
\pagestyle{empty}
\setlength{\parskip}{0bp}
\setlength{\parindent}{0pt}
\usepackage{marginnote}
\usepackage{parskip}
\usepackage{setspace}
\doublespacing

\usepackage{caption}% <-- added


\usepackage{subcaption} 
\usepackage{tabulary}
\usepackage[para]{threeparttable}
\usepackage{array,longtable,tabularx}
\usepackage{booktabs,ragged2e,ltxtable,pdflscape,filecontents}

\usepackage[flushleft, online]{threeparttablex}
\usepackage{ltablex}% 
\usepackage{booktabs,ragged2e,ltxtable,pdflscape,filecontents}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}%
\usepackage{siunitx}% <-- added

%for creating hyperref. 
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=black,
    citecolor = black,      
    urlcolor=blue,
}

\usepackage{acro}
\acsetup{list-style=longtable}




\begin{document}

\author{XYZ}
\title{ABC}
\date{July 2020}

\frontmatter
\maketitle

\tableofcontents
\listoftables
\listoffigures

\mainmatter
\include{./Chapters/Chapter1}
\include{./Chapters/Chapter2}

\backmatter
% bibliography, glossary and index would go here.

\printbibliography
\end{document}

请帮帮我,我真的很麻烦。这是一个 .blg 文件

[0] Config.pm:304> INFO - This is Biber 2.14

[0] Config.pm:307> INFO - Logfile is 'Chal jaa bass.blg'

[139] biber-MSWIN64:322> INFO - === 

[202] Biber.pm:415> INFO - Reading 'Chal jaa bass.bcf'

[489] Biber.pm:943> INFO - Found 1 citekeys in bib section 0

[525] Biber.pm:4256> INFO - Processing section 0

[525] Utils.pm:75> INFO - Globbing data source 'library.bib'

[542] Utils.pm:91> INFO - Globbed data source 'library.bib' to library.bib

[574] Biber.pm:4455> INFO - Looking for bibtex format file 'library.bib' for section 0

[622] bibtex.pm:1653> INFO - LaTeX decoding ...

[2055] bibtex.pm:1471> INFO - Found BibTeX data source 'library.bib'

[2058] Utils.pm:304> WARN - Duplicate entry key: 'Hasan2011' in file 'library.bib', skipping ...

[2146] Utils.pm:304> WARN - BibTeX subsystem: C:\Users\Ahmed\AppData\Local\Temp\biber_tmp_8yB4\library.bib_2388.utf8, line 6, warning: 172 characters of junk seen at toplevel

[2146] Utils.pm:320> ERROR - BibTeX subsystem: C:\Users\Ahmed\AppData\Local\Temp\biber_tmp_8yB4\library.bib_2388.utf8, line 1269, syntax error: found "2013", expected ","

[2147] Biber.pm:128> INFO - WARNINGS: 2

[2147] Biber.pm:132> INFO - ERRORS: 1

答案1

如果您的参考书目无法正确编译,那么查看.blg文件(Biber 的日志文件)总是一个好主意。

虽然你应该调查

[2058] Utils.pm:304> WARN - Duplicate entry key: 'Hasan2011' in file 'library.bib', skipping ...

这表明你有两个具有相同密钥的条目Hasan2011

[2146] Utils.pm:304> WARN - BibTeX subsystem: C:\Users\Ahmed\AppData\Local\Temp\biber_tmp_8yB4\library.bib_2388.utf8, line 6, warning: 172 characters of junk seen at toplevel

.bib这表明文件开头有一些额外的文本(可能是良性的,也可能是格式错误的标志)

真正的问题是

[2146] Utils.pm:320> ERROR - BibTeX subsystem: C:\Users\Ahmed\AppData\Local\Temp\biber_tmp_8yB4\library.bib_2388.utf8, line 1269, syntax error: found "2013", expected ","

在文件第 1269 行左右,.bibBiber 需要,但看到了2013。此类错误的常见原因是输入键中有空格。输入键可能不包含空格,因此以下内容会引发此类错误

@article{Smoth 2013,

将其更改为

@article{Smoth2013,

我想有可能以其他方式生成引用的错误,但这似乎是最常见的原因,特别是如果该文件是软件生成的。

相关内容