Mathtext spacing

I just downloaded the latest matplotlib (0.63.4) for Windows XP. I got rid of my font cache to make sure they would be re-generated. I have two questions/issues:

1) The font cache was not re-created, for some reason.

2) The spacing in math text does not seem to be rendered. I may be doing something wrong. I have tried this in both the TkAgg and GTKAgg backends. If i modify the example script mathtext_demo.py so the line

title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20)

becomes

title(r'$\Delta_i^j \hspace{0.4} \rm{versus some} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20)

the space between 'versus' and 'some' is not rendered on my machine.

If you have any idea why that is, i'd be very grateful.
Thanks,
Dominique

That's the normal behavior of TeX math-mode. I believe you want:

   \rm{versus \ some}

--Matt

···

On Fri, 1 Oct 2004, Dominique Orban wrote:

I just downloaded the latest matplotlib (0.63.4) for Windows XP. I got
rid of my font cache to make sure they would be re-generated. I have two
questions/issues:

1) The font cache was not re-created, for some reason.

2) The spacing in math text does not seem to be rendered. I may be doing
something wrong. I have tried this in both the TkAgg and GTKAgg
backends. If i modify the example script mathtext_demo.py so the line

title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4}
\Delta_{i+1}^j$', fontsize=20)

becomes

title(r'$\Delta_i^j \hspace{0.4} \rm{versus some} \hspace{0.4}
\Delta_{i+1}^j$', fontsize=20)

the space between 'versus' and 'some' is not rendered on my machine.

Hi,

I cannot build matplotlib-0.63.4 on gentoo linux. The error I get when running
python setup.py build is:

running build_ext
building 'matplotlib._na_transforms' extension
creating build/temp.linux-i686-2.3
creating build/temp.linux-i686-2.3/src
creating build/temp.linux-i686-2.3/CXX
gcc -fno-strict-aliasing -DNDEBUG -fPIC -Isrc -I. -I/usr/include/python2.3 -c
CXX/IndirectPythonInterface.cxx -o
build/temp.linux-i686-2.3/CXX/IndirectPythonInterface.o -DNUMARRAY=1
gcc -fno-strict-aliasing -DNDEBUG -fPIC -Isrc -I. -I/usr/include/python2.3 -c
CXX/cxxsupport.cxx -o build/temp.linux-i686-2.3/CXX/cxxsupport.o -DNUMARRAY=1
In file included from CXX/cxxsupport.cxx:6:
./CXX/Objects.hxx: In constructor
`Py::MapBase<T>::const_iterator::const_iterator(const Py::MapBase<T>*,
Py::List, Py::SeqBase<Py::Object>::iterator)':
./CXX/Objects.hxx:2271: error: `s' undeclared (first use this function)
./CXX/Objects.hxx:2271: error: (Each undeclared identifier is reported only
once for each function it appears in.)
error: command 'gcc' failed with exit status 1

I have python 2.3.3, GCC 3.4.2, Numeric 23.3, numarray 1.0, pygtk-2.3.97 (I
ungraded from pygtk-2.2.0 but that did not help), and wxpython-2.4.2.4

I hope that is enough information - do I have the wrong versions - or am I
missing something - I had no trouble building matplotlib-0.62.x

Cheers
Chris

Quoting Matt Newville <newville@...189...>:

···

On Fri, 1 Oct 2004, Dominique Orban wrote:

> I just downloaded the latest matplotlib (0.63.4) for Windows XP. I got
> rid of my font cache to make sure they would be re-generated. I have two
> questions/issues:
>
> 1) The font cache was not re-created, for some reason.
>
> 2) The spacing in math text does not seem to be rendered. I may be doing
> something wrong. I have tried this in both the TkAgg and GTKAgg
> backends. If i modify the example script mathtext_demo.py so the line
>
> title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4}
> \Delta_{i+1}^j$', fontsize=20)
>
> becomes
>
> title(r'$\Delta_i^j \hspace{0.4} \rm{versus some} \hspace{0.4}
> \Delta_{i+1}^j$', fontsize=20)
>
> the space between 'versus' and 'some' is not rendered on my machine.

That's the normal behavior of TeX math-mode. I believe you want:

   \rm{versus \ some}

Certainly, my example was giving the expected result (i.e. with spacing) in
older versions of matplotlib. If the argument of \rm{} were to be interpreted
as math mode, it would appear as an equation where the variables v, e, r, s, u,
s, s, o, m and e are multiplied together. It doesn't.

Dominique

Hi Dominique,

> > title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4}
> > \Delta_{i+1}^j$', fontsize=20)
> >
> > becomes
> >
> > title(r'$\Delta_i^j \hspace{0.4} \rm{versus some} \hspace{0.4}
> > \Delta_{i+1}^j$', fontsize=20)
> >
> > the space between 'versus' and 'some' is not rendered on my machine.
>
> That's the normal behavior of TeX math-mode. I believe you want:
>
> \rm{versus \ some}

Certainly, my example was giving the expected result (i.e. with
spacing) in older versions of matplotlib. If the argument of
\rm{} were to be interpreted as math mode, it would appear as an
equation where the variables v, e, r, s, u, s, s, o, m and e are
multiplied together. It doesn't.

Hmm.... For me, mathtext renders your expression as latex does
(except that with latex \hspace needs units and the resulting
\Delta looks a bit less slanted). The result does appear to
include the product of variables v,e,r,s,u,s,s,o,m, and e. The
variables are set in a roman font, but are still in math mode.

I can't tell if you're getting or *expecting* different results
from what latex gives. All I can say is that mathtext seems to
behave correctly (ie, closing emulating latex) for me. I would've
sworn this was the behavior of recent versions of mathtext, but
perhaps it has not always been this way.

IMHO, I think the decision to closely emulate TeX for math
typesetting was billiant, and that the implementation is amazing.

--Matt