LaTeX, eps, ghostscript, and the like

     dvipng is producing scaled images that look correct.

    > This command (at a variety of resolutions) produces
    > nice, dithered output, even when using tex files from
    > tex_cache. See attached '3.0' at dpi=150. Lovely...

Try hard coding the full path to dvipng from the command line and in
texmanager to make sure you are using the version you think you are.
Also, flush the tex cache.

Find this bit of code in texmanager

            vers = self.get_dvipng_version()
            #print 'dvipng version', vers
            if vers<'1.6':
                # hack the alpha channel as described in comment above
                alpha = sqrt(1-X[:,:,0])
            else:
                alpha = X[:,:,-1]

print the dvipng version in texmanager. Also, see which part of the
conditional you are executing, and then manually try forcing both with

            if 1:
                # hack the alpha channel as described in comment above
                alpha = sqrt(1-X[:,:,0])
            else:
                alpha = X[:,:,-1]

and

            if 0:
                # hack the alpha channel as described in comment above
                alpha = sqrt(1-X[:,:,0])
            else:
                alpha = X[:,:,-1]

Make sure you flush the tex cache and rerun matplotlib from the shell
(not ipython) with each test.

JDH

        if vers<'1.6':

This seemed to be the problem (perhaps vers<=‘1.6’ is meant). I use version dvipng version 1.6, but the alpha hack still seems to be required. When I force the hack, the PNG output looks good. Three cheers for the MPL-users list! (Four for JDH!)

Now, if you’ll bear with me, I need to get EPS (then, ultimately, encapsulated PDF) output. I am getting an error like (from verbose:helpful) :

savefig(‘foo.eps’)

[…]

dvips: Font ecrm1000 at 72 not found; scaling 600 instead.

dvips: Such scaling will generate extremely poor output.

This is dvips(k) 5.95b Copyright 2005 Radical Eye Software (www.radicaleye.com)

’ TeX output 2006.02.07:1621’ -> /tmp/bc5f66f5eb5ed881504e9f305289dc95.ps

<tex.pro><psfrag.pro><special.pro><color.pro>. [1

<bc5f66f5eb5ed881504e9f305289dc95.eps>]

GNU Ghostscript 8.16: Unrecoverable error, exit code 1

Any clues?

-Rob

···

On Feb 7, 2006, at 12:38 PM, John Hunter wrote:


Rob Hetland, Assistant Professor

Dept of Oceanography, Texas A&M University

p: 979-458-0096, f: 979-845-6331

e: hetland@…760…, w: http://pong.tamu.edu

I am having a similar problem with online display Latex in matplotlib WXAgg where the display is low resolution .
  It sounds like you fixed it. I tried to follow the email exchange but I am not sure everything I need to know is there.
Could you summarize exactly what the fix is?

I have matplotlib 0.86.2 and OSX 10.4.4

Hi Robert,

I am working on clearing up the code for cvs, but wanted to double check with
you: what did you have to do to fix the dvipng problem? I ask because I also
have dvipng version 1.6, and dont have any problems with the cvs codebase.
WOuld you send me the output of dvipng -v?

···

On Tuesday 07 February 2006 17:35, Robert Hetland wrote:

On Feb 7, 2006, at 12:38 PM, John Hunter wrote:
> if vers<'1.6':

This seemed to be the problem (perhaps vers<='1.6' is meant). I use
version dvipng version 1.6, but the alpha hack still seems to be
required. When I force the hack, the PNG output looks good. Three
cheers for the MPL-users list! (Four for JDH!)

Now, if you'll bear with me, I need to get EPS (then, ultimately,
encapsulated PDF) output. I am getting an error like (from

verbose:helpful) :
>>> savefig('foo.eps')

[.....]

dvips: Font ecrm1000 at 72 not found; scaling 600 instead.
dvips: Such scaling will generate extremely poor output.

This is dvips(k) 5.95b Copyright 2005 Radical Eye Software
(www.radicaleye.com)
' TeX output 2006.02.07:1621' -> /tmp/
bc5f66f5eb5ed881504e9f305289dc95.ps
<tex.pro><psfrag.pro><special.pro><color.pro>. [1
<bc5f66f5eb5ed881504e9f305289dc95.eps>]

GNU Ghostscript 8.16: Unrecoverable error, exit code 1

Any clues?

-Rob

-----
Rob Hetland, Assistant Professor
Dept of Oceanography, Texas A&M University
p: 979-458-0096, f: 979-845-6331
e: hetland@...760..., w: http://pong.tamu.edu

--
Darren S. Dale, Ph.D.
Cornell High Energy Synchrotron Source
Cornell University
200L Wilson Lab
Rt. 366 & Pine Tree Road
Ithaca, NY 14853

dd55@...163...
office: (607) 255-9894
fax: (607) 255-9001

I am using the I-Installer version of teTeX on Mac OS X. I imagine that many other Mac users might be experiencing similar problems. Here is what worked for me, with many thanks to Darren for helping me work through this:

First, using the dvipng 'hack' for dvipng versions less than 1.6 worked to get me PNG output using LaTeX. Also, commenting out line 141 in texmanager:

         self._font_preamble = '\n'.join([r'\usepackage{type1cm}',
                              cmd,
# r'\usepackage[T1]{fontenc}', # The guilty line
                              r'\usepackage{textcomp}'])k

allowed me to save EPS files that work very well.

Finally, for those of you interested in editing EPS files in Illustrator, you need to worry about the absence of the Computer Modern fonts in Adobe products. This link (really work checking out if you do scientific graphics on a Mac) explains how to get everything working for Illustrator CS and CS2:

http://darkwing.uoregon.edu/~noeckel/Illustrator.html

Finally, an answer to Darren's qustion:

WOuld you send me the output of dvipng -v?

~$ dvipng --version
This is dvipng 1.6 Copyright 2002-2005 Jan-Ake Larsson
dvipng 1.6
kpathsea version 3.5.5
Copyright (C) 2002-2005 Jan-Ake Larsson.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files
named COPYING and dvipng.c.

-Rob

···

On Feb 9, 2006, at 8:06 AM, Darren Dale wrote:

-----
Rob Hetland, Assistant Professor
Dept of Oceanography, Texas A&M University
p: 979-458-0096, f: 979-845-6331
e: hetland@...760..., w: http://pong.tamu.edu

what is this doing differently than the 1.6 hack?
what is wrong with the eps files?

···

  Also, commenting out line 141 in texmanager:

        self._font_preamble = '\n'.join([r'\usepackage{type1cm}',
                             cmd,
# r'\usepackage[T1]{fontenc}', # The guilty line
                             r'\usepackage{textcomp}'])k

allowed me to save EPS files that work very well.

Finally, for those of you interested in editing EPS files in Illustrator, you need to worry about the absence of the Computer Modern fonts in Adobe products. This link (really work checking out if you do scientific graphics on a Mac) explains how to get everything working for Illustrator CS and CS2:

what is this doing differently than the 1.6 hack?
what is wrong with the eps files?

The following discussion addresses a problem found in the latex code, and has
nothing to do with the dvipng hack. I am working on fixing these problems in
cvs, but I need to do some testing first.

> Also, commenting out line 141 in texmanager:
>
> self._font_preamble = '\n'.join([r'\usepackage{type1cm}',
> cmd,
> # r'\usepackage[T1]{fontenc}', #
> The guilty line
> r'\usepackage{textcomp}'])k
>
> allowed me to save EPS files that work very well.

There is some issue related to the dvipng hack that I dont understand. Robert
and Samuel want to apply the hack to dvipng version 1.6. I also have version
1.6, but if I apply the hack, then my output doesnt look right. Whats going
on here? Are there two OS dependent versions of dvipng-1.6?

Darren

···

On Thursday 09 February 2006 09:59, Samuel M. Smith wrote: