Since I wanted a better readability of highlights of a would be black & white-printed document, I needed to change both the highlighting color (gray) AND the font color (white).

Depending which command you implement inside the other will compile or not: \hl{\textcolor{white}{Fail}} does not work, compiling returns Package xcolor Error: Undefined color '{white}'.

Here's the mwe:

\usepackage{soul} % Enables highlighting


    %% Error:
    %% Package xcolor Error: Undefined color `{white}'.


So, in the end, the problem is sorta solved but I thought you might have an answer as to what happens.

1 Answer 1


The error message is the one you get from


with spurious doubled braces, and that is in fact the command that is executed.

\hl makes a pre-scan of its argument in order to do whatever it does and then re-constructs the argument to be evaluated. In this instance its reconstruction is not perfect and it inserts extra braces.

You can hide the construct from the scan inside an extra pair of braces



You must log in to answer this question.

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