From 2ddfc0b1434495491620170a7fc89d2103eb0255 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova Date: Sun, 18 Aug 2024 19:26:44 +0100 Subject: [PATCH] update \XC@mcolor in pgf.sty rather than pgfsys-latexml.def The change guarantees that \XC@mcolor is updated after color/xcolor are loaded, but also before finishing loading PGF. --- lib/LaTeXML/Package/pgf.sty.ltxml | 5 +++++ lib/LaTeXML/Package/pgfsys-latexml.def.ltxml | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/LaTeXML/Package/pgf.sty.ltxml b/lib/LaTeXML/Package/pgf.sty.ltxml index e92773e6b..89a8255f4 100644 --- a/lib/LaTeXML/Package/pgf.sty.ltxml +++ b/lib/LaTeXML/Package/pgf.sty.ltxml @@ -37,6 +37,11 @@ DefMacro('\pgfsetcolor{}', '\pgfsetcolor@orig{#1}\lxSVG@set@color'); DefPrimitive('\lxSVG@set@color', sub { MergeFont(color => LookupValue('color_pgfstrokecolor')); }); +# This seems to be needed to actually set colors (code similar to xxcolor.sty) +if (XEquals(T_CS('\XC@mcolor'), T_CS('\relax'))) { + Let('\XC@mcolor', '\@empty'); } +AddToMacro('\XC@mcolor', '\pgfsetcolor{.}'); + # This makes this conditional always true; Why??? DefConditionalI('\ifpgf@relevantforpicturesize', undef, sub { 1; }); DefMacroI('\pgf@relevantforpicturesizefalse', undef, ''); diff --git a/lib/LaTeXML/Package/pgfsys-latexml.def.ltxml b/lib/LaTeXML/Package/pgfsys-latexml.def.ltxml index cb3b86b0d..c77b66717 100644 --- a/lib/LaTeXML/Package/pgfsys-latexml.def.ltxml +++ b/lib/LaTeXML/Package/pgfsys-latexml.def.ltxml @@ -439,9 +439,6 @@ DefConstructor('\lxSVG@eorulefalse', '', alias => '\pgfsys@eorulefalse', s DefMacro('\lxSVG@setcolor{}{}', '\ifpgfpicture\lxSVG@begingroup{#1={#2}}\fi'); -# Need to defer until after color/xcolor are loaded! -AtBeginDocument('\def\XC@mcolor{\pgfsetcolor{.}}'); - #===================================================================== # Implementation