软件包 xcolor 的选项冲突

软件包 xcolor 的选项冲突

我正在尝试像这样在标题上设置一些颜色

\usepackage[svgnames]{xcolor}
\usepackage[labelfont={color=red,bf}]{caption}

但它给了我这个错误“xcolor 包选项冲突”。但是当我在实时预览中看到它确实发生了冲突。我做错了什么?这是漏洞前言

\documentclass[12pt]{report}
\usepackage[nottoc]{tocbibind}
\usepackage[lmargin=25mm,rmargin=20mm,tmargin=20mm,bmargin=20mm]{geometry}
\usepackage{array}
\usepackage{wrapfig}
\usepackage{hyperref}
\usepackage{natbib}
\usepackage{graphicx} % support the \includegraphics command and options
\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage[T1]{fontenc} 
\usepackage{listings}
\usepackage{lastpage} % for the number of the last page in the document
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage[document]{ragged2e}
\usepackage{setspace} 
\usepackage[svgnames]{xcolor}
\usepackage[labelfont={color=red,bf}]{caption}

\newcommand{\soa}{The Soma Project}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand\Signature[4]{\par\bigskip
\newcommand{\asp}{ASP.NET }
\newcommand{\aspm}{ASP.Net MVC 3}
\newcommand{\nh}{Nhibernate }

  \setlength\tabcolsep{0pt}
  \begin{tabular}{@{\hspace{.05\textwidth}}>{\centering\arraybackslash}p{.4\textwidth}
      @{\hspace*{.1\textwidth}}>{\centering\arraybackslash}p{.4\textwidth}@{\hspace{.05\textwidth}}}
  \multicolumn{2}{c}{#1, \today} \\[10ex]
  \rule{.4\textwidth}{0.4pt} & \rule{.4\textwidth}{0.4pt} \\
  #2 & #3 \\[10ex]
\end{tabular}
\par
}% for example, change the margins to 2 inches all roundhh

\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor =black,
    linkcolor=black,
    urlcolor  =black
}

\lstset{literate=%
{æ}{{\ae}}1
{å}{{\aa}}1
{ø}{{\o}}1
{Æ}{{\AE}}1
{Å}{{\AA}}1
{Ø}{{\O}}1
}


\pagestyle{fancy}

\lstset{extendedchars=\true}
\lstset{inputencoding=ansinew}

\fancyhf{}
\lhead{\leftmark}

%\lhead{Morten Starck \& Steffan Jensen}
\rhead{Section \thesection}
%\lfoot{\today}
\rfoot{Page \thepage\ af \pageref{LastPage}}
%\cfoot{\leftmark}
\usepackage{multirow}

\geometry{a4paper}

\usepackage{listings}
\usepackage{textcomp}
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\lstset{
    backgroundcolor=\color{lbcolor},
    tabsize=4,
    rulecolor=,
    language=matlab,
        basicstyle=\scriptsize,
        upquote=true,
        aboveskip={1.5\baselineskip},
        columns=fixed,
        showstringspaces=false,
        extendedchars=true,
        breaklines=true,
        prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
        frame=single,
        showtabs=false,
        showspaces=false,
        showstringspaces=false,
        identifierstyle=\ttfamily,
        keywordstyle=\color[rgb]{0,0,1},
        commentstyle=\color[rgb]{0.133,0.545,0.133},
        stringstyle=\color[rgb]{0.627,0.126,0.941},
}

\lstdefinelanguage{CSharp}
{
 morecomment = [l]{//}, 
 morecomment = [l]{///},
 morecomment = [s]{/*}{*/},
 morestring=[b]", 
 sensitive = true,
 morekeywords = {abstract,  event,  new,  struct,
   as,  explicit,  null,  switch,
   base,  extern,  object,  this,
   bool,  false,  operator,  throw,
   break,  finally,  out,  true,
   byte,  fixed,  override,  try,
   case,  float,  params,  typeof,
   catch,  for,  private,  uint,
   char,  foreach,  protected,  ulong,
   checked,  goto,  public,  unchecked,
   class,  if,  readonly,  unsafe,
   const,  implicit,  ref,  ushort,
   continue,  in,  return,  using,
   decimal,  int,  sbyte,  virtual,
   default,  interface,  sealed,  volatile,
   delegate,  internal,  short,  void,
   do,  is,  sizeof,  while,
   double,  lock,  stackalloc,   
   else,  long,  static,   
   enum,  namespace,  string}
}

\hypersetup{pdfauthor={Morten T. Starck \& Steffan Jensen},
pdftitle={\soa},
pdfsubject={Afsluttende Bachelor Projekt PBA2011},
pdfkeywords={Dette er under copy right 2012 fra Morten Starck \& Steffan Jensen. Samt Virtual Lab APs.},
pdfproducer={Morten Starck \& Steffan Jensen \today},
pdfcreator={pdflatex, \LaTeX}]{hyperref}}

\usepackage[section]{placeins}

答案1

xcolor包由 加载listings。将该行放在 之前\usepackage{listings}

但是你的前言很乱。最重要的是,你要将 称为hyperref最后一个包,并将所有选项放在geometry之前fancyhdr

按照您的设置,该包ucs毫无用处。

相关内容