使用 Texworks 將 URL 取得到我的 .bib 檔案時出錯

使用 Texworks 將 URL 取得到我的 .bib 檔案時出錯

當嘗試將我的 .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 :)

相關內容