2

I have a problem with LaTeX packages. My problem seems to be with xcolor, and very close from this question, but the their solution do not work for me.

Unfortuntly, even if I put \usepackage[table,xcdraw]{xcolor} before \usepackage{xcolor} the problem continues...

Is there a simple/magic solution ?

Here is the packages I use:

\documentclass[
11pt, % The default document font size, options: 10pt, 11pt, 12pt
%oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
french, % ngerman for German
singlespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
%nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
%liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
%toctotoc, % Uncomment to add the main table of contents to the table of contents
%parskip, % Uncomment to add space between paragraphs
%nohyperref, % Uncomment to not load the hyperref package
headsepline, % Uncomment to get a line under the header
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
%consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
table,
]{MastersDoctoralThesis} % The class file specifying the document structure

\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters

\usepackage{amsmath} % Use the Palatino font by default

\usepackage[table,xcdraw]{xcolor} % pas OK

\usepackage{xcolor} %OK

\usepackage{hyperref}

\usepackage[bottom]{footmisc}

\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)

\addbibresource{example.bib} % The filename of the bibliography

\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography

\usepackage{capt-of}

\usepackage{subfigure}

\usepackage{caption}

\usepackage{float}

\usepackage{graphicx}

\usepackage{amssymb}

\usepackage{amsfonts}

\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\mdfdefinestyle{MyFrame}{%
    linecolor=black,
    outerlinewidth=2pt,
    roundcorner=20pt,
    innertopmargin=\baselineskip,
    innerbottommargin=\baselineskip,
    innerrightmargin=20pt,
    innerleftmargin=20pt,
    backgroundcolor=gray!20!white}

And here is the table I used in one of the chapters (from this website):

% Please add the following required packages to your document preamble:
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[]
\begin{tabular}{|c|
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{EFEFEF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{EFEFEF}}c |
>{\columncolor[HTML]{FFFFFF}}c |
>{\columncolor[HTML]{EFEFEF}}c |
>{\columncolor[HTML]{FFFFFF}}c |}
\hline
Row 1: & \#1   & \#2  & \#3   & \#4   & \#5      & \#6     & \#7     \\ \hline
Row 2: & 12 \% & 1 \% & 15 \% & 25 \% & 18.75 \% & 12.5 \% & 6.25 \% \\ \hline
\end{tabular}
\end{table}
  • 1
    If you already load \usepackage[table,xcdraw]{xcolor} you don't need \usepackage{xcolor} – samcarter Dec 11 '18 at 12:10
  • 2
    Why do you load the xcolor package two times? Try to load it just one time (with options). – Dr. Manuel Kuehner Dec 11 '18 at 12:11
  • 2
    Where is this MastersDoctoralThesis?, are you sure that class is not already loading xcolor? You can try \RequirePackage[table,xcdraw]{xcolor} before \documentclass to see if that helps. – daleif Dec 11 '18 at 12:20
  • @samcarter that particular loading order should not give this error. – daleif Dec 11 '18 at 12:20
  • @daleif I'm not saying that this is the cause of the problem, just that it is not necessary – samcarter Dec 11 '18 at 12:21
7
\PassOptionsToPackage{table,xcdraw}{xcolor}
\documentclass{...}

 everything _without_ xcolor

\begin{document}
...
\end{document}

Package tikz (via package framed) already loads xcolor internally

  • It does not work: erro message is Missing \begin{document}. \PassOptionsToPackage{table,xcdraw}[xcolor} . Of course I have the \begin{document} after in the maint.tex I am writting in. @Herbert – Agape Gal'lo Dec 11 '18 at 13:21
  • 1
    @AgapeGal'lo there is a typo: use \PassOptionsToPackage{table,xcdraw}{xcolor} – user4686 Dec 11 '18 at 13:29
  • In fact, it works when I use \PassOptionsToPackage{table,xcdraw}{xcolor} ! Thanks a lot ! I have no idea how you got the problem :o @Herbert – Agape Gal'lo Dec 11 '18 at 13:40
  • It is now corrected in my answer – Herbert Dec 12 '18 at 5:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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