mathtext is smaller than regular text

Hello all,

Does anyone know why mathtext is smaller than the regular text in the same
string? For example, see
http://matplotlib.sourceforge.net/users/text_intro.html
(equation E=mc^2)

How can I make it of equal size? I don't see any mathtext size settings in
rcfile...

Thanks in advance!

Konstantin

In your matplotlibrc file uncomment “mathtext.default : regular” to get the same font between the equations and regular text.

···

On Tue, Apr 27, 2010 at 3:31 AM, Konstantin Klementiev <kklementiev@…3040…> wrote:

Hello all,

Does anyone know why mathtext is smaller than the regular text in the same

string? For example, see

http://matplotlib.sourceforge.net/users/text_intro.html

(equation E=mc^2)

How can I make it of equal size? I don’t see any mathtext size settings in

rcfile…

Thanks in advance!

Konstantin


Gökhan

Mathtext is in a completely different font (Computer Modern), so it has a different x-height, even though it does have the same overall height.

While there isn't a way to change the size of part of a Text object, you could put the math its own Text object and use the 'fontsize' kwarg to change its size.

You might also see more font "harmony" by using the STiX math font (set the rcParam mathtext.fontset to 'stix') alongside Times, or by using Computer Modern everywhere by (if you have LaTeX installed), setting the rcParam text.usetex to True.

Mike

Konstantin Klementiev wrote:

···

Hello all,

Does anyone know why mathtext is smaller than the regular text in the same
string? For example, see http://matplotlib.sourceforge.net/users/text_intro.html
(equation E=mc^2)

How can I make it of equal size? I don't see any mathtext size settings in
rcfile...

Thanks in advance!

Konstantin

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

From: Gokhan Sever:
In your matplotlibrc file uncomment "mathtext.default : regular" to get the
same font between the equations and regular text.

Then the mathematics italic is lost. I can force it back by \it and then I have
the same small letters.

From: Michael Droettboom:
Mathtext is in a completely different font (Computer Modern), so it has
a different x-height, even though it does have the same overall height.

In a "normal" TeX document mathtext is also represented by another font,
nevertheless the sizes do match. In matplotlib the string
r'm$\rm{m}$$m$'
results in three differently sized m's! (see the tiny png attached)

From: Michael Droettboom:
While there isn't a way to change the size of part of a Text object, you
could put the math its own Text object and use the 'fontsize' kwarg to
change its size.

If you have several math inclusions, this way becomes tedious...

You might also see more font "harmony" by using the STiX math font
(set the rcParam mathtext.fontset to 'stix') alongside Times,

Maybe this is backend specific but I don't see any change when using stix.

Ok, there seem to be no easy solution of this bug/"not a bug"/feature...
Thanks!

fontsizes.png

Using the fourier package (set it in your matplotlibrc file and make sure you have the package installed in latex) provides for seamless text/mathtext rendering.

I've attached an example to demonstrate. Hope this helps,
-paul h.

···

-----Original Message-----
From: Konstantin Klementiev [mailto:kklementiev@…3040…]
Sent: Tuesday, April 27, 2010 1:32 AM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] mathtext is smaller than regular text

Hello all,

Does anyone know why mathtext is smaller than the regular text in the
same
string? For example, see
http://matplotlib.sourceforge.net/users/text_intro.html
(equation E=mc^2)

How can I make it of equal size? I don't see any mathtext size settings
in
rcfile...

Thanks in advance!

Konstantin