当我使用此代码时:
\documentclass[portuges]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[square,numbers]{natbib}
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{xcolor}
\usepackage{geometry}
\geometry{tmargin=2cm,lmargin=2.2cm,rmargin=2cm,bmargin=2.2cm}
\begin{document}
\bibliographystyle{plainnat}
\bibliography{Ref}
\end{document}
我不断得到:
Package natbib Warning: Citation `Frid' on page 5 undefined on input line 167.
Package natbib Warning: Citation `artcl' on page 5 undefined on input line 173.
Package natbib Warning: Citation `cap' on page 5 undefined on input line 190.
(TPC_eletro.bbl
! Illegal parameter number in definition of \reserved@a.
<to be read again>
我做错了什么?我的 bib 文件如下所示:
@Book{Frid,
author = {Fridman, Alexander},
publisher = {Taylor \& Francis},
title = {Plasma physics and engineering},
year = {2004},
address = {New York},
isbn = {1560328487},
pages = {559-560},
pagetotal = {2},
}
@Article{artcl,
author = {Alice Hong},
title = {Dielectric Strength of Air},
year = {2000},
comment = {An educational, fair use website},
url = {https://hypertextbook.com/facts/2000/AliceHong.shtml},
}
@Article{cap,
title = {Cylindrical Capacitor},
year = {2006},
url = {http://hyperphysics.phy-astr.gsu.edu/hbase/electric/capcyl.html#c2},
}
@Article{plast,
journal = {Omnexus},
title = {Dielectric Constant},
year = {2015},
comment = {An educational, fair use website},
url = {https://omnexus.specialchem.com/polymer-properties/properties/dielectric-constant},
}
即使没有这个包装它也能运行得很好natbib
。
答案1
无论何时在文档中排版 URL,加载url
或hyperref
包都是一个好主意(url
如果您只关心 URL,则加载;hyperref
如果您想要链接的 URL 和文档中的附加链接(例如来自\ref
或目录中的链接),则hyperref
加载;url
因此通常不需要同时加载两者)。
如果未url
加载hyperref
任何内容,natbib
则使用 fallback 定义来打印无法#
正确处理特殊字符的 URL。如果 URL 中出现此类字符,您可能会收到非常隐晦的错误消息,如问题中引用的 only 所示。
\documentclass[portuges]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[square,numbers]{natbib}
\usepackage{url}
% or
%\usepackage{hyperref}
\begin{filecontents}{\jobname.bib}
@misc{cap,
title = {Cylindrical Capacitor},
year = {2006},
url = {http://hyperphysics.phy-astr.gsu.edu/hbase/electric/capcyl.html#c2},
}
\end{filecontents}
\begin{document}
\citep{cap}
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}