usetex font problem

I am having a problem with the fonts with the usetex option. My plots
look beautiful on the screen and the labels are in a san-serif font
that I would guess is Helvetica. My rc files has this setting in it:
font.latex.package : type1cm

But when I save these plots and include them in a LaTeX file (or look
at them with a posscript viewer), the font seems to have switched to
times and the legends don't fit in the legend boxes any more.

What am I doing wrong?

Ryan

Playing with this a little bit more, times and pslatex seem to be the
only settings for font.latex.package that make any difference. I
still don't get the pretty san serif font I get on the screen, but at
least the legend boxes are right. Does it make sense that the on
screen font is different? I thought that was coming from dvipng and
would be generated by latex. What is the on screen font and how do I
get it into my eps files?

Thanks,

Ryan

···

On 1/28/06, Ryan Krauss <ryanlists@...287...> wrote:

I am having a problem with the fonts with the usetex option. My plots
look beautiful on the screen and the labels are in a san-serif font
that I would guess is Helvetica. My rc files has this setting in it:
font.latex.package : type1cm

But when I save these plots and include them in a LaTeX file (or look
at them with a posscript viewer), the font seems to have switched to
times and the legends don't fit in the legend boxes any more.

What am I doing wrong?

Ryan

Shot in the dark: Try clearing you tex.cache.

If you set pslatex, the adobe postscript fonts will be used instead of the
computer modern fonts. So if you do {\sffamily Print this in sans-serif} with
pslatex, you get helvetica fonts. You can do the same with computer modern.

Times is a subset of pslatex, the computer modern fonts end up being used for
math.

···

On Saturday 28 January 2006 20:15, Ryan Krauss wrote:

Playing with this a little bit more, times and pslatex seem to be the
only settings for font.latex.package that make any difference. I
still don't get the pretty san serif font I get on the screen, but at
least the legend boxes are right. Does it make sense that the on
screen font is different? I thought that was coming from dvipng and
would be generated by latex. What is the on screen font and how do I
get it into my eps files?

clearing the tex.cache doesn't seem to make a difference. times is
still the only package thae doesn't overflow the legend box and the on
screen is always san serif and the eps is always serif.

···

On 1/28/06, Darren Dale <dd55@...163...> wrote:

On Saturday 28 January 2006 20:15, Ryan Krauss wrote:
> Playing with this a little bit more, times and pslatex seem to be the
> only settings for font.latex.package that make any difference. I
> still don't get the pretty san serif font I get on the screen, but at
> least the legend boxes are right. Does it make sense that the on
> screen font is different? I thought that was coming from dvipng and
> would be generated by latex. What is the on screen font and how do I
> get it into my eps files?

Shot in the dark: Try clearing you tex.cache.

If you set pslatex, the adobe postscript fonts will be used instead of the
computer modern fonts. So if you do {\sffamily Print this in sans-serif} with
pslatex, you get helvetica fonts. You can do the same with computer modern.

Times is a subset of pslatex, the computer modern fonts end up being used for
math.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I think this is now fixed in cvs.

···

On Saturday 28 January 2006 10:04 pm, Ryan Krauss wrote:

clearing the tex.cache doesn't seem to make a difference. times is
still the only package thae doesn't overflow the legend box and the on
screen is always san serif and the eps is always serif.

I don't know what I am doing wrong, but I just checked out everything
from cvs and when I go into the directory and do a sudo python
setup.py install and then import matplotlib, it says my version is
0.86.2 and I still have the same problems as before. It seems like
cvs versions always had a cvs at the end of them before.

···

On 1/28/06, Darren Dale <dd55@...163...> wrote:

On Saturday 28 January 2006 10:04 pm, Ryan Krauss wrote:
> clearing the tex.cache doesn't seem to make a difference. times is
> still the only package thae doesn't overflow the legend box and the on
> screen is always san serif and the eps is always serif.

I think this is now fixed in cvs.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Darren Dale wrote:

···

On Saturday 28 January 2006 10:04 pm, Ryan Krauss wrote:

clearing the tex.cache doesn't seem to make a difference. times is
still the only package thae doesn't overflow the legend box and the on
screen is always san serif and the eps is always serif.

I think this is now fixed in cvs.

I made similar observations here. With matplotlib from cvs, an empty tex-cache,
without own matplotlibrc and setting
rcParams['text.usetex'] = True
I get sans-serif fonts on screen (I guess it is the WXAgg backend) and serif
fonts in the eps output and the legend box is mostly too small.

Regards, Christian

My version also says 0.86.2. Maybe the problem is that non-developer checkout
is lagging. Try checking out again, your backend_ps is the only file that
required changing. If it still does not reflect the changes, just inserted
the following lines into the RendererPS.draw_tex method at line 641:

        if rcParams['text.tex.engine'] == 'latex':
            fontcmd = {'sans-serif' : r'{\sffamily %s}',
                   'monospace' : r'{\ttfamily %s}'}.get(
                    rcParams['font.family'], r'{\rmfamily %s}')
            s = fontcmd % s

These commands produced the attached eps file (fontfamily is sans-serif in
matplotlibrc):

In [1]: plot([2,3,4,5])
Out[1]: [<matplotlib.lines.Line2D instance at 0xb5ba71cc>]

In [2]: plot([1,2,3,4])
Out[2]: [<matplotlib.lines.Line2D instance at 0xb5bb5b0c>]

In [3]: legend(('IIIIIIIIIIIIII','IIIIIIIIIIIIII'), 2) # Those are capital i's
Out[3]: <matplotlib.legend.Legend instance at 0xb5bb982c>

In [4]: savefig('sans-serif.eps')

sans-serif.eps (20.6 KB)

···

On Saturday 28 January 2006 11:56 pm, Ryan Krauss wrote:

I don't know what I am doing wrong, but I just checked out everything
from cvs and when I go into the directory and do a sudo python
setup.py install and then import matplotlib, it says my version is
0.86.2 and I still have the same problems as before. It seems like
cvs versions always had a cvs at the end of them before.

That seems to have done it. And CVS is caught up for non-developers.
Thanks for all your hard work Darren. I can now have my choice of
serif or san-serif fonts and the eps files match the screen. You can
still have problems if you change your rc file without clearing you
tex.cache. I don't know if a note about that in the rc file would cut
down on problems or not.

Thanks again,

Ryan

···

On 1/29/06, Darren Dale <dd55@...163...> wrote:

On Saturday 28 January 2006 11:56 pm, Ryan Krauss wrote:
> I don't know what I am doing wrong, but I just checked out everything
> from cvs and when I go into the directory and do a sudo python
> setup.py install and then import matplotlib, it says my version is
> 0.86.2 and I still have the same problems as before. It seems like
> cvs versions always had a cvs at the end of them before.

My version also says 0.86.2. Maybe the problem is that non-developer checkout
is lagging. Try checking out again, your backend_ps is the only file that
required changing. If it still does not reflect the changes, just inserted
the following lines into the RendererPS.draw_tex method at line 641:

        if rcParams['text.tex.engine'] == 'latex':
            fontcmd = {'sans-serif' : r'{\sffamily %s}',
                   'monospace' : r'{\ttfamily %s}'}.get(
                    rcParams['font.family'], r'{\rmfamily %s}')
            s = fontcmd % s

These commands produced the attached eps file (fontfamily is sans-serif in
matplotlibrc):

In [1]: plot([2,3,4,5])
Out[1]: [<matplotlib.lines.Line2D instance at 0xb5ba71cc>]

In [2]: plot([1,2,3,4])
Out[2]: [<matplotlib.lines.Line2D instance at 0xb5bb5b0c>]

In [3]: legend(('IIIIIIIIIIIIII','IIIIIIIIIIIIII'), 2) # Those are capital i's
Out[3]: <matplotlib.legend.Legend instance at 0xb5bb982c>

In [4]: savefig('sans-serif.eps')

I know Fernando had posted questions about changing the font package
and John said something about adding the font family to the cache
somehow. I was talking specifically of having problems when switching
from serif to sans-serif and needing to clear the cache when you do.

···

On 1/29/06, Ryan Krauss <ryanlists@...287...> wrote:

That seems to have done it. And CVS is caught up for non-developers.
Thanks for all your hard work Darren. I can now have my choice of
serif or san-serif fonts and the eps files match the screen. You can
still have problems if you change your rc file without clearing you
tex.cache. I don't know if a note about that in the rc file would cut
down on problems or not.

Thanks again,

Ryan

On 1/29/06, Darren Dale <dd55@...163...> wrote:
> On Saturday 28 January 2006 11:56 pm, Ryan Krauss wrote:
> > I don't know what I am doing wrong, but I just checked out everything
> > from cvs and when I go into the directory and do a sudo python
> > setup.py install and then import matplotlib, it says my version is
> > 0.86.2 and I still have the same problems as before. It seems like
> > cvs versions always had a cvs at the end of them before.
>
> My version also says 0.86.2. Maybe the problem is that non-developer checkout
> is lagging. Try checking out again, your backend_ps is the only file that
> required changing. If it still does not reflect the changes, just inserted
> the following lines into the RendererPS.draw_tex method at line 641:
>
> if rcParams['text.tex.engine'] == 'latex':
> fontcmd = {'sans-serif' : r'{\sffamily %s}',
> 'monospace' : r'{\ttfamily %s}'}.get(
> rcParams['font.family'], r'{\rmfamily %s}')
> s = fontcmd % s
>
> These commands produced the attached eps file (fontfamily is sans-serif in
> matplotlibrc):
>
> In [1]: plot([2,3,4,5])
> Out[1]: [<matplotlib.lines.Line2D instance at 0xb5ba71cc>]
>
> In [2]: plot([1,2,3,4])
> Out[2]: [<matplotlib.lines.Line2D instance at 0xb5bb5b0c>]
>
> In [3]: legend(('IIIIIIIIIIIIII','IIIIIIIIIIIIII'), 2) # Those are capital i's
> Out[3]: <matplotlib.legend.Legend instance at 0xb5bb982c>
>
> In [4]: savefig('sans-serif.eps')
>
>
>
>
>

That seems to have done it. And CVS is caught up for non-developers.
Thanks for all your hard work Darren.

My pleasure.

I can now have my choice of
serif or san-serif fonts and the eps files match the screen. You can
still have problems if you change your rc file without clearing you
tex.cache. I don't know if a note about that in the rc file would cut
down on problems or not.

Thanks for pointing this out. It is fixed in CVS, Line 79 in texmanager has
been changed to read:

            s+='latex font: %s %s'% (rcParams['font.latex.package'],
                rcParams['font.family'])

So it should not be necessary to clear your tex.cache.

···

On Sunday 29 January 2006 11:53 am, you wrote: