Hello,
I noticed a possible bug in the xcolor package. Line 5824 in xcolor.dtx reads \ifnum\XC@tracing>2, it should be \ifnum\XC@tracing>3. Do you agree? If that is a bug, I could tell the author of the package.
Text Formatting ⇒ Possible bug in xcolor package
NEW: TikZ book now 40% off at Amazon.com for a short time.
Re: Possible bug in xcolor package
why don't you ask him anyway?
I would also assume that that kind of questions might be better posted on comp.text.tex, as the xcolor author is more likely to read that newsgroup than this forum
I would also assume that that kind of questions might be better posted on comp.text.tex, as the xcolor author is more likely to read that newsgroup than this forum
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Possible bug in xcolor package
I agree with daleif. This simple line has no meaning without knowing the context.
Moreover I wonder what the increase of the last digit is good for and what is finally the bug it shall cause. But you are welcome to post the result of your research here.
Best regards
Thorsten¹
Code: Select all
\ifnum\XC@tracing>2
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Possible bug in xcolor package
OK, sorry for the bad explanation. The current version of xcolor is more than two years old and I would be really surprised if nobody had noticed this bug yet. According to the manual, commands that set colors are traced only if \tracingcolors is at least 4. But the relevant macro \XC@display tests for \tracingcolors ≥ 3, not 4. Here is an example:
There are two messages regarding the setting of a color in the log file, but should be only the second one if I understand the manual correctly. By applying the patch (uncommenting the \ApplyPatch line) this behavior disappears of course. I'm very sure that this is a bug. I wanted to inform the author as soon as I realized this, but then I noticed that the package hasn't been updated for two years, and I couldn't really believe that I should be the first to find this bug.
Code: Select all
\documentclass{article}
\usepackage{xcolor}
\makeatletter
\newcommand*\ApplyPatch{%
\CheckCommand*\XC@display{%
\XC@bcolor\XC@let@cN{\string\color@.}\XC@current@color
\ifnum\XC@type{.}=1
\PackageWarning{xcolor}{Incompatible color definition}%
\else
\ifnum\XC@tracing>2
\begingroup
\let\xcolor@\@empty
\def\@nil{\string\@nil}%
\PackageInfo{xcolor}{Setting color `\XC@current@color'}%
\endgroup
\fi
\fi
\XC@mcolor\set@color\XC@ecolor\ignorespaces
}%
\renewcommand*\XC@display{%
\XC@bcolor\XC@let@cN{\string\color@.}\XC@current@color
\ifnum\XC@type{.}=1
\PackageWarning{xcolor}{Incompatible color definition}%
\else
\ifnum\XC@tracing>3
\begingroup
\let\xcolor@\@empty
\def\@nil{\string\@nil}%
\PackageInfo{xcolor}{Setting color `\XC@current@color'}%
\endgroup
\fi
\fi
\XC@mcolor\set@color\XC@ecolor\ignorespaces
}%
}
\makeatother
%\ApplyPatch
\begin{document}
\tracingcolors=3
\textcolor{red}{foo}
\tracingcolors=4
\textcolor{blue}{foo}
\end{document}