blog

Posts Tagged ‘LaTeX’

dvipng color trouble

金曜日, 12 月 28th, 2007

I still have yet to find a fix to the dvipng discoloration mystery I ran into back at The Academic Approach, even with the latest MacTeX version, so I’m going to repost the problem here.

In May 2007, I wrote the following to the OS X TeX listhost:1

Hi all,

I’ve recently run into what I believe is a rare bug in dvipng: here’s the setup. (To play along, you can get my test files: http://mitcho.com/discolor.zip .) I am using MacTeX… in fact, it’s today’s release.

The LaTeX source file (discolored.tex) loads just two packages: color and graphicx. The body does two things: an \includegraphics with a local PNG file (with the bb option to specify the BoundingBox explicitly) and a \textcolor command introducing some green text, using the green defined there.

pdflatex produces the expected result: the figure and the green text.

Original color

But when you run the following commands…

latex discolored.tex

dvipng -D 200 discolored.dvi

you get a PNG (discolored1.png) which shows the text in a brownish color… the green is gone!!

Discolored version

There are two quick ways to fix this that I’ve found: one is to not include the image… if you comment the \includegraphics command out, the color comes out fine. The second is to not specify a -D (output resolution) parameter in the dvipng… this also gives you the expected output. However, in my current project, neither of these are available options…

I am frankly not very familiar with the inner workings of dvipng… does anyone have any thoughts? Can this bug be reproduced?

Any hints or suggestions are welcome!

Ditto.

discolor.zip
496 kb - zip

  1. Inline cropped images added to this web version, just to spice things up. 


© 2006-2008 mitcho (Michael 芳貴 Erlewine).
Proudly powered by WordPress.
Entries (RSS) and Comments (RSS).
The views expressed on these pages are mine alone and do not
reflect those of my employers and clients, past and present.