[dvipdfmx] black color lost

Shunsaku Hirata shunsaku.hirata74 at gmail.com
Fri Aug 16 15:20:44 CEST 2019


Hi Ulrike,

Thank you for reporting.

I'm not very sure but this issue is probably due to the following
kind of code:

\documentclass{article}
\begin{document}
\special{pdf:bcolor [0]}
\special{pdf:code q 1 0 0 rg 1 0 0 RG}
\special{color push gray 0}
Text in black.
\special{color pop}
\special{pdf:code Q}
\special{pdf:ecolor}
\end{document}

"Text in black" above is drawn in red.

This occurs because dvipdfmx does not know that current color
is changed to "red" via pdf:code (dvipdfmx does not verify the
content of "pdf:code" special) and then it wrongly assumes
actual color change does not occur when "color push gray 0" is
invoked. Dvipdfmx does not output color change operators
("0 g 0 G") since it mistakenly consider them unnecessary.

I will try changing dvipdfmx code to always write color changes.

Thanks,
Shunsaku Hirata

2019年8月16日(金) 18:54 Ulrike Fischer <news3 at nililand.de>:
>
> On tex.sx a problem was reported that with xelatex  some color
> settings are lost in a pgfplots
>
> https://tex.stackexchange.com/questions/504279/xelatex-with-pgfplots-displays-wrong-color
>
> In this example the axis is green despite the setting \pgfplotsset{axis line style=black}
>
>
> I couldn't make a smaller example without pgfplots, but it could be
> that is isn't a pgfplots problem but has someting to do with dvipdfmx:
>
> If works if one use a gray color (\pgfplotsset{axis line
> style=black!50}) instead:
>
> \documentclass[]{article}
> \special{dvipdfmx:config z 0}
> \usepackage{xcolor}
> \usepackage{tikz}
> \usepackage{pgfplots}
> \pgfplotsset{axis line style=black} %works with e.g. black!50
> \color{green}
> \begin{document}\showoutput
>
>     \begin{tikzpicture}
>         \begin{axis}
>          \addplot {x*x};
>         \end{axis}
>     \end{tikzpicture}
> \end{document}
>
> The specials shown by showoutput are identical, only that the working
> example uses
>
> ............\special{color push gray 0.5}
> ............\special{color push gray 0.5}
>
> instead of
>
> ............\special{color push gray 0}
> ............\special{color push gray 0}
>
>
> but the pdf stream shows 0.5 G 0.5 g in the working example with gray but
> nothing in the failing.
>
>
>
> --
> Mit freundlichen Grüßen
> Ulrike Fischer
>
>



More information about the dvipdfmx mailing list