I have defined the color of my fonts in the preamble. What I am trying to accomplish is to change the color of just one word within the document, but I am unable to do this.

Usually, within the body of the document I would use:


{\color{blue} This sentence is blue}


But for some reason this method does not work. Any thoughts would be much appreciated.

Here is my preamble:


% Adjust margins



% Color definitions

% Set main fonts
\setmainfont[Color=primary, Path = fonts/lato/,BoldItalicFont=Lato-RegIta,BoldFont=Lato-Reg,ItalicFont=Lato-LigIta]{Lato-Lig}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text, Path = fonts/raleway/]{Raleway-ExtraLight}

You can use \addfontfeature to change the font color:



\setmainfont[Color=primary]{Latin Modern Roman}


This sentance is in primary color.
{\addfontfeature{Color=blue} This sentence is blue}
This sentance is in primary color.



enter image description here


The Answer by Ralf works with XeLaTeX alternatively using LuaLaTeX you can continue using \color{blue}



This sentence is primary color
{\color{blue} This sentence is blue}

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.