Closed kpym closed 1 year ago
Please show a small but complete example. That makes it much easier to test the issue.
@u-fischer Here is an example of MWE (the results are identical with pdflatex
and with xelatex
).
\documentclass{article}
\usepackage{iftex}
\ifPDFTeX
\usepackage[utf8]{inputenc}
\else
\usepackage{fontspec}
\fi
% --------------------------
\usepackage{xcolor}
\colorlet{hl}{red!35!white}
% --------------------------
\usepackage{soulutf8}
% --------------------------
\begin{document}
\sethlcolor{hl}
\hl{Test using \texttt{hl} color}
\sethlcolor{red!35!white}
\hl{Test using \texttt{red!35!white} color}
\end{document}
@u-fischer This behavior is not specific to soulutf8
because we can see the same thing with the original soul
package.
\documentclass{article}
% --------------------------
\usepackage{xcolor}
\colorlet{hl}{blue!35!white}
% --------------------------
\usepackage{soul}
% --------------------------
\begin{document}
\sethlcolor{hl}
\hl{Test using \texttt{hl} color}
\sethlcolor{blue!35!white}
\hl{Test using \texttt{blue!35!white} color}
\end{document}
a quick workaround would seem to be
\documentclass{article}
% --------------------------
\usepackage{xcolor}
\colorlet{hl}{blue!35!white}
% --------------------------
\usepackage{soul}
\let\zz\sethlcolor
\def\sethlcolor#1{\colorlet{soul-#1}{#1}\zz{soul-#1}}
% --------------------------
\begin{document}
\sethlcolor{hl}
\hl{Test using \texttt{hl} color}
\sethlcolor{blue!35!white}
\hl{Test using \texttt{blue!35!white} color}
\end{document}
@davidcarlisle We can even do a more dirty thing: \def\sethlcolor#1{\colorlet{#1}{#1}\zz{#1}}
;)
What I do not understand is that in the code it looks like \sethlcolor
use the color only through \textcolor{#1}
which should be ok... but probably I miss something.
@kpym It is a known incompability between soul and xcolor, see https://tex.stackexchange.com/a/520315/2388
We will look for a real fix.
@u-fischer Tanks for considering my request and to pointing me to the TeX.SX topic.
This has been resolved with version 3.0.
For some reason I can't use directly colors like
yellow!35!white
. The following code worksbut the following one don't
It looks like that
soul(utf8)
use under the hood\textcolor
which is ok with mixed colors. So I can't get it why it is not working.