![使用 Texworks 获取 .bib 文件中的 URL 时出错](https://linux22.com/image/370511/%E4%BD%BF%E7%94%A8%20Texworks%20%E8%8E%B7%E5%8F%96%20.bib%20%E6%96%87%E4%BB%B6%E4%B8%AD%E7%9A%84%20URL%20%E6%97%B6%E5%87%BA%E9%94%99.png)
当我尝试将我的 .bib 文件放入我的 .tex 时,我收到此错误消息。
You're missing a field part---line 52 of file Bib.bib
: howpublished =
: "{\url{https://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15859-f11/www/notes/lecture05.pdf}}"
I'm skipping whatever remains of this entry
在我的 .tex 文件中,我按如下方式开始我的参考书目:
\bibliographystyle{plainnat}
\bibliography{Bib}
我的此 URL 的 .bib 文件的错误信息如下:
@misc{10,
author = "Anupam Gupta",
title = "Linear Programming Duality",
howpublished = "{\url{https://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15859-f11/www/notes/lecture05.pdf}}"
}
我的序言很长,但内容如下:
\usepackage{graphicx} % For including graphics (via \includegraphics).
\usepackage{amsmath} % Improves typographic quality of mathematical output.
\usepackage{amsfonts} % For mathematical fonts.
\usepackage{multirow}
\usepackage{dsfont}
\usepackage{amsthm} % Needed to typeset theorem environments.
\usepackage[affil-it]{authblk} % Needed for author and affiliation.
\usepackage{amsopn} % Allows the declaration of new mathematical operators.
\usepackage{amssymb} % Extended set of mathematical symbols.
\usepackage{mathrsfs} % Raph Smith's mathematical script font.
\usepackage{booktabs} % Improves the typographical quality of tables.
\usepackage{natbib} % Citations and bibliography.
\usepackage{tikz} % Extends the figure generation capabilities of LaTeX.
\usepackage{algorithm} % Necessary for including algorithmic structures.
\usepackage{float} % Allows the creation of own floating environments.
\usepackage{caption} % Allows the customisation of captions.
\usepackage{abstract} % For including abstracts in documents.
\usepackage{listings} % For the inclusion of source code.
\usepackage{color} % Used for colour commands.
\usepackage{pgfplots} %extends tikz functionality
\usepackage{hyperref,lipsum}
\usepackage{url}
\usepackage[english]{babel}
\usepackage[parfill]{parskip}
\usepackage[scale=0.8,vmarginratio={1:2},heightrounded]{geometry}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows}
答案1
问题在于howpublished
字段的分隔符。
bibtex 文件的有效分隔符是双引号 ( " "
) 和花括号 ( { }
)。
您发布的文件使用了一对单引号 ( '' ''
),这会破坏 bibtex。
将您的条目更改为:
@misc{10,
author = "Anupam Gupta",
title = "Linear Programming Duality",
howpublished = "\url{https://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15859-f11/www/notes/lecture05.pdf}"
}
或者
@misc{10,
author = "Anupam Gupta",
title = "Linear Programming Duality",
howpublished = {\url{https://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15859-f11/www/notes/lecture05.pdf}}
}
并且它会起作用。
(确保删除 .aux 和 .bbl 文件以强制 texmaker 再次运行 bibtex:)