XeTeX 给出选项冲突错误

XeTeX 给出选项冲突错误

.tex我正在尝试清除此文件中令人抓狂的错误:

%
% Syllabus template for use with http://kjhealy.github.com/latex-custom-kjh
%
\documentclass[11pt,article,oneside]{memoir}

%% Script-based version control (requires vc package)
% \input{vc}

\usepackage{graphicx,url}
\usepackage{rotating}
\usepackage{memoir-article-styles} % in latex-custom-kjh/needs-memoir

%% Choose font system. Comment out these lines if you are not using xelatex
\usepackage{fontspec}
\usepackage{xunicode}

% Biblatex
\usepackage[american]{babel}
\usepackage[babel]{csquotes}
\usepackage[style=authoryear,
            bibstyle=authoryear,
            citestyle=authoryear-comp,
            uniquename=false,
            hyperref=true,
            backend=biber, babel=hyphen, bibencoding=inputenc]{biblatex}

%% Fix biblatex's odd preference for using In: by default.
\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{}\intitlepunct}}}

%% Bibliography from http://kjhealy.github.com/socbibs/
\addbibresource{/Users/kjhealy/Documents/bibs/socbib.bib}

% Definitions
\def\myauthor{Kieran Healy}
\def\mytitle{Sociology 155: Organizations and Management}
\def\mysubtitle{Syllabus}
\def\mycopyright{\myauthor}
\def\mykeywords{}
\def\mybibliostyle{plain}
\def\mybibliocommand{}
\def\mysubtitle{}
\def\myaddress{276 Soc/Psych}
\def\myemail{[email protected]}
\def\myweb{http://www.kieranhealy.org}
\def\myphone{660-5737}
\def\myaffiliation{\ \\Duke University}
\def\mykeywords{Sociology, Syllabus, Undergraduate, Organizations, Management}

%% Links
\usepackage[usenames,dvipsnames]{color}
\usepackage[xetex,
colorlinks=true,
urlcolor=BrickRed,
plainpages=false,
   pdfpagelabels,
   bookmarksnumbered,
   pdftitle={\mytitle},
   pdfauthor={\myauthor},
   pdfkeywords={\mykeywords}
   ]{hyperref}

%% Uncomment to make a "DRAFT" watermark
% Page watermark
% \usepackage{type1cm,eso-pic}
% \makeatletter
% \AddToShipoutPicture{%
% \setlength{\@tempdimb}{.5\paperwidth}%
% \setlength{\@tempdimc}{.5\paperheight}%
% \setlength{\unitlength}{1pt}%
% \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
% \makebox(0,0){\rotatebox{45}{\textcolor[gray]{0.9}%
% {\fontsize{3cm}{3cm}\selectfont{Draft Only}}}}%
% Marginal Watermark
% \makebox(-100,-300){\rotatebox{45}{\textcolor[gray]{0.95}%
% {\fontsize{2cm}{2cm}\selectfont{}}}}
% \makebox(-500,-0){\rotatebox{90}{\textcolor[gray]{0.95}%
% {\fontsize{0.7cm}{0.7cm}\selectfont{}}}}
% }%
% }
% \makeatother

\begin{document}

%%% xelatex font choices
%\defaultfontfeatures{}
%\defaultfontfeatures{Scale=MatchLowercase}
% You will need to buy these fonts, change the names to fonts you own, or comment out if not using xelatex.
\setromanfont[Mapping=tex-text]{Minion Pro}
\setsansfont[Mapping=tex-text]{Myriad Pro}
\setmonofont[Mapping=tex-text,Scale=0.8]{Pragmata}

%% blank label items; hanging bibs for text
%% Custom hanging indent for vita items
\def\ind{\hangindent=1 true cm\hangafter=1 \noindent}
\def\labelitemi{$\cdot$}
%\renewcommand{\labelitemii}{~}

% Make figures as wide as the margins
\setkeys{Gin}{width=1\textwidth}

\chapterstyle{article-2} % alternative styles are defined in latex-custom-kjh/needs-memoir/. Consider e.g.\chapterstyle{article-4}
\pagestyle{kjh}

\title{\mytitle}
\author{\myauthor\smallskip\footnotesize\newline Office: 276 Sociology/Psychology \newline\texttt{\myemail} \newline \url{http://www.kieranhealy.org}}
\date{}

\published{\sffamily Spring 2010 / Tu\&Th 1:15--2:30pm / Gray 228}

\maketitle

% Include version information in footer if using vc package (see above).
% \thispagestyle{kjhgit}


% Copyright Page
% \textcopyright{} \mycopyright


%
% Main Content
%

\section{Course Description and Objectives}

%\newpage
%% Uncomment if you want a printed bibliography.
%\printbibliography

\end{document}

我收到以下错误:

/home/larry/Desktop/kjhealy-latex-custom-kjh-f5ba457/templates/basic/.syllabus.t
ex.swp:53: LaTeX Error: Option clash for package color.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.53 \usepackage
                [xetex,
No pages of output.
Transcript written on /tmp/.syllabus.tex.log.

任何想法都将不胜感激...

答案1

LaTeX 仅加载一次包。如果对已加载的包执行进一步的\usepackage命令\RequirePackage,LaTeX 仅检查选项,如果发现任何在加载包时不存在的新选项,则发出警告。

例子:

\documentclass{article}
\usepackage{color}% might be hidden in a package
\usepackage[usenames,dvipsnames]{color}
\begin{document}
\end{document}

LaTeX 抱怨“选项冲突”错误消息。按“h”键可显示详细信息:

! LaTeX Error: Option clash for package color.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.4 \begin
          {document}
? h
The package color has already been loaded with options:
  []
There has now been an attempt to load it with options
  [usenames,dvipsnames]
Adding the global options:
  ,usenames,dvipsnames
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.
? 

全局选项

帮助文本还提供了一种解决方法,将选项放入全局选项中。但是,考虑到选项名称(例如),其他软件包可能会看到它们,这可能不是最佳选择draft。因此,如果以下方法失败,我将使用全局选项作为最后的手段。

使用所有选项提前加载

如果包加载顺序无关紧要,则可以在较早的阶段使用所有选项加载包:

\documentclass{article}
\usepackage[usenames,dvipsnames]{color}
% ...
\usepackage{color}% might be hidden in a package
% ...
\usepackage[usenames,dvipsnames]{color}
% ...
\usepackage[dvipsnames]{color}

\PassOptionsToPackage

通常包加载不是显式的,而是隐藏在其他包甚至类中。然后\PassOptionsToPackage帮助也可以使用 \documentclass

\PassOptionsToPackage{usenames,dvipsnames}{color}
\documentclass{...}
...

相关内容