![软件包 [square]{natbib} 的选项冲突](https://linux22.com/image/354037/%E8%BD%AF%E4%BB%B6%E5%8C%85%20%5Bsquare%5D%7Bnatbib%7D%20%E7%9A%84%E9%80%89%E9%A1%B9%E5%86%B2%E7%AA%81.png)
如果我调用natbib
,LaTeX 运行起来没有问题。但是,如果我有以下内容
\usepackage[square, comma, numbers, sort&compress, super]{natbib}
它没有运行,并且出现以下错误:
Latex Error: Option clash for package natbib
该文件的完整开头是:
\documentclass[preprint,showpacs,preprintnumbers,showkeys]{revtex4}
\newcommand{\classoption}[1]{\texttt{#1}}
\newcommand{\macro}[1]{\texttt{\textbackslash#1}}
\newcommand{\m}[1]{\macro{#1}}
\newcommand{\env}[1]{\texttt{#1}}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{bm}
\usepackage{color}
\usepackage{natbib}
\usepackage[square,
comma,
numbers,
sort&compress,
super]{natbib}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\usepackage{amssymb,amsmath,amsfonts}
\usepackage[hang,scriptsize,tight]{subfigure}
\begin{document}
答案1
natbib
无需使用各种选项重新加载包,只需执行
\usepackage{natbib}
\setcitestyle{square, comma, numbers,sort&compress, super}
顺便说一下,选项numbers
和super
相互排斥:选择其中一个,但并非两者兼而有之。
答案2
我不知道这是否会产生预期的结果,但以下内容可以在没有选项冲突的情况下进行编译:
\PassOptionsToPackage{square,comma,numbers,sort&compress,super}{natbib}
\documentclass[preprint,showpacs,preprintnumbers,showkeys]{revtex4}
\newcommand{\classoption}[1]{\texttt{#1}}
\newcommand{\macro}[1]{\texttt{\textbackslash#1}}
\newcommand{\m}[1]{\macro{#1}}
\newcommand{\env}[1]{\texttt{#1}}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{bm}
\usepackage{color}
%\usepackage{natbib}
%\usepackage[square,
%comma,
%numbers,
%sort&compress,
%super]{natbib}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\usepackage{amssymb,amsmath,amsfonts}
\usepackage[hang,scriptsize,tight]{subfigure}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
答案3
revtex4
本身已经加载。你应该在natbib
之前传递选项的原因documentclass
natbib
\PassOptionsToPackage{square,comma,numbers,sort&compress,super}{natbib}
\documentclass[preprint,showpacs,preprintnumbers,showkeys]{revtex4}
\newcommand{\classoption}[1]{\texttt{#1}}
\newcommand{\macro}[1]{\texttt{\textbackslash#1}}
\newcommand{\m}[1]{\macro{#1}}
\newcommand{\env}[1]{\texttt{#1}}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{bm}
\usepackage{color}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\usepackage{amssymb,amsmath,amsfonts}
\usepackage[hang,scriptsize,tight]{subfigure}
\begin{document}
foo
\end{document}