使用选项时出现 Natbib 错误

使用选项时出现 Natbib 错误

我有一个像这样的 TeX 文件

\documentclass[twocolumn]{webofc}

\usepackage{natbib}
\usepackage[varg]{txfonts}   % Web of Conferences font
\usepackage{booktabs}
\usepackage{array} %% needed for advanced table manipulation
\usepackage{amsmath}
\usepackage{bm}
\usepackage{float}
\usepackage[caption = false]{subfig}
\usepackage{graphicx}

\usepackage[font={footnotesize}]{caption}
\usepackage{epstopdf}
\usepackage{afterpage}
\usepackage{color}
\usepackage{multirow}
\usepackage{url}
\urlstyle{same}
\def\UrlBreaks{\do\/\do-}

\begin{document}

....

\bibliographystyle{plainnat}
\bibliography{ACOc}
\end{document}

如果我使用\citet{}显示,例如(Author?)[3]。当使用natbib选项时,如[square][numbers]它不会编译,因为它告诉无法识别该选项。我也测试了plainbib 样式而不是plainnat使用相同的结果。我不知道问题是否与其他包或 doc 样式不兼容。我想使用\citet{ref}所以它显示Smith et al.[3]格式。

非常感谢你的帮助

问候

答案1

您收到的错误消息是Option class for package natbib。(下次请将其包含在您的问题中。)

这意味着您使用的包webofc已经调用了natbib带有选项的包,不包括square

为了能够将你想要的选项传递给包,natbib请使用命令

\PassOptionsToPackage{square}{natbib} % option package

使用以下 MWE

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Goossens,
  author    = {Goossens, Michel and Mittelbach, Frank and 
               Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
}
@Book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
@article{Wurm2004,
  author = {Wurm, Florian M.},
  doi = {10.1038/nbt1026},
  file = {:C$\backslash$:/Users/sille/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Unknown - Unknown - R E V I E W.pdf:pdf},
  journal = {Nature Biotechnology},
  number = {11},
  pages = {393--398},
  title = {{Production of recombinant protein therapeutics in cultivated mammalian cells}},
  url = {https://doi.org/10.1038/nbt1026},
  volume = {22},
  year = {2004}
}
@misc{obs,
  title  = "Titre", 
  author = {Joe Doe},
  year   = {2017},
  url    = {https://www.reallylongurl.fr/aaaa/bbbbbbbbbbbbbbbbb/ccccccc-ccccc_ddddddddd?eeeeeeeeee=125784.pdf}
}
@ARTICLE{AD.Smith2001,
  author    = {Arthur D. Smith},
  title     = {A simple model of LaTeX References.},
  journal   = {Journal of LaTeX},
  year      = {2001},
  volume    = {100},
  pages     = {1--10},
  number    = {3},
  keywords  = {LaTeX models; biology},
  doi       = {10.1115/1.1372322},
  publisher = {Cambridge},
  url       = {http://link.aip.org/link/?PBY/321},
}
@article{stacey1999,
  TITLE   = "Learning the Algebraic Method of Solving Problems",
  JOURNAL = "The Journal of Mathematical Behavior",
  VOLUME  = "18",
  NUMBER  = "2",
  PAGES   = "149--167",
  YEAR    = "1999",
  ISSN    = "0732-3123",
  DOI     = {10.1016/S0732-3123(99)00026-7},
  AUTHOR  = "Kaye Stacey and Mollie MacGregor",
  url     = {https://scholar.google.com.br/scholar?q='Learning+the+Algebraic+Method+of+Solving+Problems'&btnG=Search},
}
\end{filecontents*}


\documentclass[twocolumn]{webofc} % webofc

\PassOptionsToPackage{square}{natbib} % option package <================
%\usepackage[square]{natbib}

\usepackage{amsmath}

\usepackage[varg]{txfonts}   % Web of Conferences font
\usepackage{booktabs}
\usepackage{array} %% needed for advanced table manipulation

\usepackage{bm}
\usepackage{float}
\usepackage[caption = false]{subfig}
\usepackage{graphicx}

\usepackage[font={footnotesize}]{caption}
\usepackage{epstopdf}
\usepackage{afterpage}
\usepackage{color}
\usepackage{multirow}

\usepackage{url}
\urlstyle{same}
\def\UrlBreaks{\do\/\do-\do.\do+\do\n\do\l\do\o}


\begin{document}

\nocite{*}

\bibliography{\jobname}
\end{document}

您将获得最终的 pdf:

在此处输入图片描述

相关内容