I'm sorry for have been unprecise. So again. I want to have every text in the entire document in a diffrent colour, if it is written in a fontshape which does not exist in the user defined font. I'm using XeLaTeX and hope, that the following code can expain it better to you all.

    \NewDocumentCommand{\fntInf}{}{\tiny \f@family, \f@series, \f@shape\normalsize}
              ItalicFeatures={Color=FF000099}% That doesn't work
        ]{Source Serif Pro}% This font comes without support for italic or small caps. Is there a way to mark all textes which are have been automatical replaced because of an  invalid font shape/series by fontspec?
        \setmonofont{Source Serif Pro}
        \setromanfont{Source Serif Pro}

    Lalal asflas mesltne twt gheptwhpsfn\fntInf

    \textbf{ Aw hfafjat awl \fntInf\\ \\hfalfhal hawlfnals \itshape nawlhaw lfaitiowjpaöfka\fntInf} 

[Old Question, please do ignore the following text.] Is it anyhow possible to colourize the text, if the bold version of the font underneath is used (automatically!!)?

                ItalicFont={Anonymous Pro Italic},
            {Source Code Pro}

I thought I could use \addfontfeature{Color=FF000099} anyhow, but I couldn't find a solution.

Here's an example:

\documentclass[twoside, paper=A4, 11pt]{scrreprt}
\usepackage{xcolor,blindtext,multicol} % für farbigen Text

            %BoldItalicFont={Consolas}]% I want to have this always in a diffrent color.
            {Consolas} % or 'Source Code Pro'

Lalal asflas mesltne twt nwtnwthigheptwhpsfn {\FMonoA\textbf{\itshape aw hfafjat}} awl hfalfhal hawlfnals nawlhaw lfaitiowjpaöfka 

"aw hfafjat" should be in another color. Whenever I use \FMonoA in a bold+italic combination the text shall be in a different color. Idea? \addfontfeature and color=. But how?

  • 3
    Please consider accepting answers to your earlier questions. One has 3 answers; another 2. And please include a complete Minimal Working Example when asking questions, which we can compile. This helps to clarify your question, makes it easier to help and more likely answers will help.
    – cfr
    Mar 26, 2017 at 3:46
  • I've taken the liberty of moving the bulk of your follow-up "answer" to body of the query. That way, hopefully, it will be visible more readily to readers.
    – Mico
    Mar 26, 2017 at 7:03

2 Answers 2


I would use the well-documented feature of fontspec called BoldFeatures. It allows you to provide many features regarding the bold font. It works perfectly with Xe/Lua LaTeX. I suggest you to look up for the package documentation

Here is a MWE

\setmainfont[BoldFeatures={Color=0000ff}]{Linux Libertine O}

enter image description here

A more detailed example:


\newfontfamily{\FMonoA}{Source Code Pro}[
  ItalicFont=TeX Gyre Cursor Italic,


aa bb cc {\FMonoA\textbf{\textit{uuvvww}}}

aa bb cc {\FMonoA\textbf{uuvvww}}

aa bb cc {\FMonoA\textit{uuvvww}}


enter image description here


Note that this answer is NOT an answer to the current question, but to the ORIGINAL one.

No example, no code, no context. Here's a generic solution. Not specific to XeTeX. Compiles just the same with XeLaTeX or pdfLaTeX.

Here is some text.

\textbf{Here is some bold.}

Here is some more.

  This is in bold.%

Here is the last.

bold blue

The advantage of this is that all bold text will be blue, but that bold mathematics will be untouched, and that the solution is engine-agnostic. That is, the same solution will work for pdfTeX as for XeTeX etc. as it does not depend on fontspec. In general, engine-agnostic solutions are more flexible and portable.

It does not, however, address the edited version of the question and I would not have suggested it has that question been extant at the time this was written.

  • Is it really necessary to redefine the bfseries command? Maybe this is the best option, but what makes it better than using fontspec specific commands?
    – Moriambar
    Mar 26, 2017 at 9:11
  • @ilFuria Given the original question, this seemed the obvious solution. If you want all bold text to be blue, say, then making it so that switching to bold switches to blue is the most straightforward way. Moreover, it is engine-agnostic, so it will work with pdfTeX or with XeTeX without fontspec. Hence, it is more flexible and portable. Of course, given the current question, it is not a good solution. But the current question is not the one I answered.
    – cfr
    Mar 26, 2017 at 15:58
  • 1
    I can understand this being down-voted as an answer to the current question, but down-voter please note that that was not the question I answered!
    – cfr
    Mar 26, 2017 at 16:00
  • I understand. I thought I might've missed something!
    – Moriambar
    Mar 26, 2017 at 16:02
  • @ilFuria Only the original version of the question, which turns out not to be the one the OP wants answering :-).
    – cfr
    Mar 26, 2017 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .