0

I use latex to create PDF for some academic journals and now I am using a Template to Layout articles. I have downloaded some templates and using them but I cant add none of zebra option to the tables. My document starts with following codes and packages:

\documentclass[fleqn,10pt]{SelfArx} % Document font size and equations flushed left
\usepackage[english]{babel} % Specify a different language here - english by default
\usepackage{adjustbox}
\usepackage{footnote}
\usepackage{multirow,color}
\usepackage{graphicx}
\usepackage{chemformula}
\usepackage{balance}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{flushend}
\usepackage{colortbl}
\DeclareGraphicsExtensions{.pdf,.jpg,.png}

I wanted to use [svgnames,table]{xcolor} and \rowcolors{5}{}{gray!10} but latex shows me error and do not proceed to PDF, the error is LaTeX Error: Option clash for package xcolor.. I have created several documents and all of them works fine with rowcolors commands expect the document that starts with above codes. Has anybody a suggestion that how can I add zebra to the tables in my document? or why LaTex shows me error every time? Is there any other way to add zebra style to the tables?

  • 2
    Welcome to TeX.SX! You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui. Can you please expand your code snippet to a minimal working example: that is, to a minimal chunk of compilable code that demonstrates your problem. – Andrew Dec 15 '17 at 15:03
4

This probably means your document class or some extension already loads xcolor with other options or none, whence the option clash.

You can either add svgnames and table to the documentclass options, or write in the preamble

\PassOptionsToPackage{svgnames, table}{xcolor}

B.t.w., needless to load color, nor colortbl if you load xcolor with option [table], since it loads them for you.

Also (unrelated): the language options of babel should be loaded with the document class, and you don't have to declare these graphic extensions: they're already known to the graphic driver.

  • 1
    It's the normal behaviour. Or declare the options with the document class, as I said. The reason is that chemformula loads tikz, which loads xcolor. – Bernard Dec 15 '17 at 15:29
  • Or \usepackage[table]{xcolor} before chemformula... – clemens Dec 27 '17 at 12:27
  • Under the condition that chemformula (indirectly) loads it without option. – Bernard Dec 27 '17 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.