1

Problem:

I am trying to define colors using the xcolor-material package but receive an error when compiling.

Error message:

Paragraph ended before \XC@definec@lor was complete.

Minimal Working Example (MWE):

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[swedish]{babel}
\usepackage{xcolor}
\usepackage{kvoptions}
\usepackage{xcolor-material}

% Material Colors
\definecolor{MaterialOrange}[cmyk]{orange}

\begin{document}

{\color{MaterialOrange}Hello}

\end{document}
  • Try with \definecolor{MaterialOrange}{named}{orange} – samcarter_is_at_topanswers.xyz Mar 20 '17 at 17:43
  • You are aware that \color{MaterialOrange}Hello is not really useful -- even for this MWE ... if used otherwise it will cause color bleeding into the rest of the document – user31729 Mar 20 '17 at 17:46
  • @samcarter But according to the manual you need to load the cmyk option? – kexxcream Mar 20 '17 at 17:50
  • 1
    @kexxcream Where does it say this? I only found 10 occurrences of cmyk in the xcolor-material documentation and none said something like this. – samcarter_is_at_topanswers.xyz Mar 20 '17 at 17:53
  • 1
    @kexxcream: cmyk option wouldn't work even for the normal xcolor \definecolor command. – user31729 Mar 20 '17 at 17:54
3

orange is predefined, you can simply use it as {\color{orange}Hello} without any color definitions. Otherwise, use the form \definecolor{MaterialOrange}{named}{orange} as noted also by @samcarter or using the color value and model given in the manual. Finally, you should embrace the colored portion between two {}, otherwise, the whole document will take the defined color.

\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[swedish]{babel}
\usepackage{xcolor}
\usepackage{kvoptions}
\usepackage{xcolor-material}

% Material Colors
%\definecolor{MaterialOrange}{named}{orange}  % This or
%\definecolor{MaterialOrange}{HTML}{FF8000}   % this or
\definecolor{MaterialOrange}{cmyk}{0,0.5,1,0} % this

\begin{document}

{\color{MaterialOrange}Hello} and normal text ..

\end{document}
| improve this answer | |
  • I just want to understand this correctly, if I use \definecolor{MaterialOrange}{named}{orange} and then {\color{MaterialOrange}Hello}, would it apply the cmyk value of that material color? – kexxcream Mar 20 '17 at 18:11
  • @kexxcream: Both orange and MaterialOrange are predefined colors and are different. Here, you copied the values of orange into MaterialOrange, they are now the same, the original cmyk of orange is now applied. – AboAmmar Mar 20 '17 at 18:18
  • Thanks, so basically one wouldn't need to define colors but instead just use them right out of the box like: {\color{MaterialOrange}Hello} - and this would apply the cmyk color, correct? – kexxcream Mar 20 '17 at 18:21
  • Yes, too many colors are predefined in the manual, but take care of the differences as I mentioned above (orange != MaterialOrange). – AboAmmar Mar 20 '17 at 18:27

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.