|
From: Benjamin R. <ben...@ou...> - 2012-09-06 13:50:19
|
On Thu, Sep 6, 2012 at 6:54 AM, Mogliii <mo...@gm...> wrote:
> Hi,
>
> I am preparing figures with the following matplotlib preamble:
>
> plt.rc('font', **{'family':'serif', 'serif':['Computer Modern Roman'],
> 'monospace':['Computer Modern Typewriter']})
> params = {'backend': 'ps',
> 'text.latex.preamble': [r"\usepackage{upgreek}",
> r"\usepackage[nice]{units}"],
> 'axes.labelsize': 12,
> 'text.fontsize': 12,
> 'legend.fontsize': 8,
> 'xtick.labelsize': 10,
> 'ytick.labelsize': 10,
> 'text.usetex': True,
> 'figure.figsize': fig_size,
> 'axes.unicode_minus': True}
> plt.rcParams.update(params)
>
>
> But when using subscript and superscript in math mode the sizes end up
> different than in my LaTeX document (my .cls is using "book" as base class).
>
> Attached are two screenshots of it rendered from matplotlib and from Latex
> (sorry for the different sizes). The "mean" is clearly of different size in
> relation to the "d".
>
>
> Is there an option to specify a .cls file in rcParams that should be used
> for rendering?
> I tried:
> text.latex.preamble': [r"\documentclass[twoside]{mycls}",
> r"\usepackage{upgreek}",
> r"\usepackage[nice]{units}"],
> but then I get the error:
> ! LaTeX Error: Two \documentclass or \documentstyle commands.
>
> How to overwrite default matplotlib one? my matplotlibrc has a commented
> preamble.
>
>
>
> See also my question on tex.stackexchange.com:
> http://tex.stackexchange.com/questions/70400/subscript-size-different-in-latex-and-matplotlib
>
>
>
> Many thanks
>
>
This might have been fixed at one point. Which version of matplotlib are
you using?
Ben Root
|