我正在 Pycharm 中使用 TeXiFy IDEA 插件,因为它对我的工作来说很方便。
我不断浏览论坛寻找类似的错误,但找不到有效的解决方案。
.tex 文件中的相关示例:
Stars are classified based on their temperature, put into classes denoted by the letters, known as the Current Harvard System\cite{1901AnHar..28..129C}.
\bibliography{main}
\bibliographystyle{plain}
我的.bib 文件:
@ARTICLE{1901AnHar..28..129C,
author = {{Cannon}, Annie J. and {Pickering}, Edward C.},
title = {Spectra of bright southern stars photographed with the 13-inch Boyden telescope as part of the Henry Draper Memorial},
journal = {Annals of Harvard College Observatory},
keywords = {STARS: SPECTRA, STARS: CATALOGS, STARS: CLASSIFICATION},
year = {1901},
month = {jan},
volume = {28},
pages = {129-P.6},
adsurl = {https://ui.adsabs.harvard.edu/abs/1901AnHar..28..129C},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
。日志档案:
Package natbib Warning: Citation `1901AnHar..28..129C' on page 1 undefined on i
nput line 46.
[1
{C:/Users/denet/AppData/Local/MiKTeX/pdftex/config/pdftex.map} <./LULogo-eps-co
nverted-to.pdf>] (C:/Users\denet\Desktop\PHYS363_Report\out\main.bbl
Package natbib Warning: Empty `thebibliography' environment on input line 3.
)
Package natbib Warning: There were undefined citations.
.aux 文件:
\providecommand\hyper@newdestlabel[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}
\citation{1901AnHar..28..129C}
\providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}}
\newlabel{fig:figure}{{\caption@xref {fig:figure}{ on input line 20}}{1}{}{figure.caption.1}{}}
\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}{section.1}\protected@file@percent }
\newlabel{sec:Intro}{{1}{1}{Introduction}{section.1}{}}
\bibdata{main}
\bibstyle{plain}
\gdef \@abspage@last{2}
.blg 文件:
Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
The top-level auxiliary file: out/main.aux
Reallocating 'name_of_file' (item size: 1) to 5 items.
I couldn't open database file main.bib
---line 24 of file out/main.aux
: \bibdata{main
: }
I'm skipping whatever remains of this command
Reallocating 'name_of_file' (item size: 1) to 6 items.
The style file: plain.bst
I found no database files---while reading file out/main.aux
Warning--I didn't find a database entry for "1901AnHar..28..129C"
从上述文件可以看出,.bbl 文件是空的:
\begin{thebibliography}{}
\end{thebibliography}
我怀疑这与编译器有关,但这不是我第一次使用 TeXiFy,它以前就起作用了。
答案1
讯息
我无法打开数据库文件 main.bib
只能意味着一件事:BibTeX 无法打开文件main.bib
。如果 bib 文件名拼写错误和/或文件main.bib
存在但不在 BibTeX 的搜索路径中,则会发生这种情况。
对您的 bib 文件的一些评论:(a) 无需将作者姓氏括在花括号中;(b) 请将Boyden
和括Henry Draper Memorial
在花括号中;(c) 此行month = {jan},
错误;(d) 由于您使用的是natbib
引文管理包,请考虑使用plainnat
而不是plain
作为参考书目样式。并且,为了让 BibTeX 有机会获得正确的格式,请写month = jan,
而不是month = {jan},
。
\documentclass{article}
%% create the file main.bib "on the fly":
\begin{filecontents}[overwrite]{main.bib}
@ARTICLE{1901AnHar..28..129C,
author = {Cannon, Annie J. and Pickering, Edward C.},
title = {Spectra of bright southern stars photographed
with the 13-inch {Boyden} telescope as part of
the {Henry Draper Memorial}},
journal= {Annals of Harvard College Observatory},
keywords={STARS: SPECTRA, STARS: CATALOGS, STARS: CLASSIFICATION},
year = {1901},
month = jan,
volume = {28},
pages = {129-P.6},
adsurl = {https://ui.adsabs.harvard.edu/abs/1901AnHar..28..129C},
adsnote= {Provided by the SAO/NASA Astrophysics Data System}
}
\end{filecontents}
\usepackage[numbers]{natbib}
\bibliographystyle{plainnat}
\begin{document}
\dots\ known as the Current Harvard System~\cite{1901AnHar..28..129C}.
\bibliography{main}
\end{document}