diff --git a/lib/LaTeXML/Engine/TeX_Box.pool.ltxml b/lib/LaTeXML/Engine/TeX_Box.pool.ltxml index 56ae014d9..ff7aa7eba 100644 --- a/lib/LaTeXML/Engine/TeX_Box.pool.ltxml +++ b/lib/LaTeXML/Engine/TeX_Box.pool.ltxml @@ -552,7 +552,8 @@ sub adjustBoxColor_rec { sub adjustBoxColor_internal { my ($color, $box) = @_; if (my $font = $box->getFont) { - $box->setFont($font->merge(color => $color)); } + if (Black->equals($font->getColor)) { + $box->setFont($font->merge(color => $color)); } } return; } DefPrimitive('\box Number', sub { diff --git a/t/graphics/xcolors.pdf b/t/graphics/xcolors.pdf index 6a81f9257..87dcd3dc7 100644 Binary files a/t/graphics/xcolors.pdf and b/t/graphics/xcolors.pdf differ diff --git a/t/graphics/xcolors.tex b/t/graphics/xcolors.tex index 01d24f069..d669c2703 100644 --- a/t/graphics/xcolors.tex +++ b/t/graphics/xcolors.tex @@ -252,6 +252,8 @@ \section{Boxes} \copy\mybox \setbox\mybox=\hbox{Should be Red!} {\color{red}\copy\mybox} +\setbox\mybox=\hbox{The final word should be \textcolor{green}{green}} +\box\mybox \section{Custom rgb directives} \color{rgb:red,4;green,2;yellow,1} Brown diff --git a/t/graphics/xcolors.xml b/t/graphics/xcolors.xml index 6e32e3cbd..00b8ac56f 100644 --- a/t/graphics/xcolors.xml +++ b/t/graphics/xcolors.xml @@ -645,7 +645,9 @@ A=100*13 = 1300pt;
Should NOT be Red!
-