When I wanted to make my math text in a LaTeX beamer presentation upright, I added the following to my beamer style file: %%Attempt to get upright math symbols \AtBeginDocument{ \DeclareSymbolFont{pureletters}{\encodingdefault}{\mathfamilydefault}{m}{n} \SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{\rmdefault}{m}{n} \DeclareMathAlphabet{\mathbf}{\encodingdefault}{\mathfamilydefault}{bx}{n} \DeclareMathAlphabet{\mathsf}{\encodingdefault}{\sfdefault}{m}{n} \DeclareMathAlphabet{\mathit}{\encodingdefault}{\mathfamilydefault}{m}{it} \DeclareMathAlphabet{\mathtt}{\encodingdefault}{\ttdefault}{m}{n} \ifx\mv at bold\@undefined\else \SetSymbolFont{numbers}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n}
\SetSymbolFont{pureletters}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n} \SetMathAlphabet{\mathrm}{bold}{\encodingdefault}{\rmdefault}{bx}{n} \SetMathAlphabet{\mathbf}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{n} \SetMathAlphabet{\mathsf}{bold}{\encodingdefault}{\sfdefault}{bx}{n} \SetMathAlphabet{\mathit}{bold}{\encodingdefault}{\mathfamilydefault}{bx}{it} \SetMathAlphabet{\mathtt}{bold}{\encodingdefault}{\ttdefault}{bx}{n} \fi \def\operator at font{\mathgroup\symnumbers} \DeclareMathSymbol{0}\mathalpha{numbers}{"30} \DeclareMathSymbol{1}\mathalpha{numbers}{"31} \DeclareMathSymbol{2}\mathalpha{numbers}{"32} \DeclareMathSymbol{3}\mathalpha{numbers}{"33} \DeclareMathSymbol{4}\mathalpha{numbers}{"34} \DeclareMathSymbol{5}\mathalpha{numbers}{"35} \DeclareMathSymbol{6}\mathalpha{numbers}{"36} \DeclareMathSymbol{7}\mathalpha{numbers}{"37} \DeclareMathSymbol{8}\mathalpha{numbers}{"38} \DeclareMathSymbol{9}\mathalpha{numbers}{"39} \DeclareMathSymbol{A}\mathalpha{pureletters}{"41} \DeclareMathSymbol{B}\mathalpha{pureletters}{"42} \DeclareMathSymbol{C}\mathalpha{pureletters}{"43} \DeclareMathSymbol{D}\mathalpha{pureletters}{"44} \DeclareMathSymbol{E}\mathalpha{pureletters}{"45} \DeclareMathSymbol{F}\mathalpha{pureletters}{"46} \DeclareMathSymbol{G}\mathalpha{pureletters}{"47} \DeclareMathSymbol{H}\mathalpha{pureletters}{"48} \DeclareMathSymbol{I}\mathalpha{pureletters}{"49} \DeclareMathSymbol{J}\mathalpha{pureletters}{"4A} \DeclareMathSymbol{K}\mathalpha{pureletters}{"4B} \DeclareMathSymbol{L}\mathalpha{pureletters}{"4C} \DeclareMathSymbol{M}\mathalpha{pureletters}{"4D} \DeclareMathSymbol{N}\mathalpha{pureletters}{"4E} \DeclareMathSymbol{O}\mathalpha{pureletters}{"4F} \DeclareMathSymbol{P}\mathalpha{pureletters}{"50} \DeclareMathSymbol{Q}\mathalpha{pureletters}{"51} \DeclareMathSymbol{R}\mathalpha{pureletters}{"52} \DeclareMathSymbol{S}\mathalpha{pureletters}{"53} \DeclareMathSymbol{T}\mathalpha{pureletters}{"54} \DeclareMathSymbol{U}\mathalpha{pureletters}{"55} \DeclareMathSymbol{V}\mathalpha{pureletters}{"56} \DeclareMathSymbol{W}\mathalpha{pureletters}{"57} \DeclareMathSymbol{X}\mathalpha{pureletters}{"58} \DeclareMathSymbol{Y}\mathalpha{pureletters}{"59} \DeclareMathSymbol{Z}\mathalpha{pureletters}{"5A} \DeclareMathSymbol{a}\mathalpha{pureletters}{"61} \DeclareMathSymbol{b}\mathalpha{pureletters}{"62} \DeclareMathSymbol{c}\mathalpha{pureletters}{"63} \DeclareMathSymbol{d}\mathalpha{pureletters}{"64} \DeclareMathSymbol{e}\mathalpha{pureletters}{"65} \DeclareMathSymbol{f}\mathalpha{pureletters}{"66} \DeclareMathSymbol{g}\mathalpha{pureletters}{"67} \DeclareMathSymbol{h}\mathalpha{pureletters}{"68} \DeclareMathSymbol{i}\mathalpha{pureletters}{"69} \DeclareMathSymbol{j}\mathalpha{pureletters}{"6A} \DeclareMathSymbol{k}\mathalpha{pureletters}{"6B} \DeclareMathSymbol{l}\mathalpha{pureletters}{"6C} \DeclareMathSymbol{m}\mathalpha{pureletters}{"6D} \DeclareMathSymbol{n}\mathalpha{pureletters}{"6E} \DeclareMathSymbol{o}\mathalpha{pureletters}{"6F} \DeclareMathSymbol{p}\mathalpha{pureletters}{"70} \DeclareMathSymbol{q}\mathalpha{pureletters}{"71} \DeclareMathSymbol{r}\mathalpha{pureletters}{"72} \DeclareMathSymbol{s}\mathalpha{pureletters}{"73} \DeclareMathSymbol{t}\mathalpha{pureletters}{"74} \DeclareMathSymbol{u}\mathalpha{pureletters}{"75} \DeclareMathSymbol{v}\mathalpha{pureletters}{"76} \DeclareMathSymbol{w}\mathalpha{pureletters}{"77} \DeclareMathSymbol{x}\mathalpha{pureletters}{"78} \DeclareMathSymbol{y}\mathalpha{pureletters}{"79} \DeclareMathSymbol{z}\mathalpha{pureletters}{"7A} } I don't know if that helps here. Perhaps you would add this to rcParams['latex.preamble'], which was always advertised as being experimental. (You may need to preface it with \makeatletter, and end with \makeatother.) -Sterling On Sep 5, 2014, at 1:21PM, Paul Hobson wrote: > How do you do this in a normal LaTeX document? > > > On Fri, Sep 5, 2014 at 12:53 PM, Arnaldo Russo <arnaldoru...@gmail.com> wrote: > Hi, > > I'm trying to figure out how I could use greek letters on axis labels, > without italic. > I have read a lot about alternatives, but I do need to use LaTeX to insert a > table inside the plot area. > > Using mathtex it responds with normal font on greek letters. > > What I`m doing wrong? > > The following code plots my table, but greek letters are not in Arial. > > import > numpy as np > > import matplotlib. > pyplot as plt > > t2 > = np.arange(100) > > fig > = plt.figure(figsize=(8,4)) > > ax > = fig.add_subplot(111) > > > plt > .rcParams.update({'font.family' : 'sans-serif', > > > 'font.sans-serif' : 'Arial', > > > 'font.style' : 'normal', > > > 'xtick.labelsize' : 12, > > > 'ytick.labelsize' : 12, > > > 'mathtext.fontset' : 'stixsans', > > > 'mathtext.default': 'regular', > > > 'mathtext.tt' : 'Arial', > > > }) > > plt > .subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1) > > > > ax > .set_xlim(0,100) > > xvals > = [0, 16.6, 33.33, 50, 66.66, 83.33, 100] > > ax > .set_xticks(xvals) > > ax > .set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4', 'tick 5', > 'tick 6']) > > ax > .set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$') > > ax > .set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400']) > > ax > .plot(t2, color='black') > > ax > .fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8) > > > > > from matplotlib import > rc > rc > ('font',**{'family':'sans-serif','sans-serif':['Arial']}) > > rc > ('text', usetex=True) > > table > = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 & tick 3 & tick > 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80 & 5 & 8 & 45 & 7.3 > \\\hline \end{tabular}''' > > plt > .text(20,80,table,size=10) > > > plt > .show() > > And an example using Mathtex, using regular fonts work out of the box, but my > table of course is included as plain text. I have to close my IPython session > and start it again to correct usage of plot parameters. > > import > numpy as np > > import matplotlib. > pyplot as plt > > t2 > = np.arange(100) > > fig > = plt.figure(figsize=(8,4)) > > ax > = fig.add_subplot(111) > > > plt > .rcParams.update({'xtick.labelsize' : 12, > > > 'ytick.labelsize' : 12, > > > 'mathtext.fontset' : 'stixsans', > > > 'mathtext.default': 'regular', > > > 'mathtext.tt' : 'Arial', > > > }) > > plt > .subplots_adjust(left=0.12, right=0.95, top=0.95, bottom=0.1) > > > > ax > .set_xlim(0,100) > > xvals > = [0, 16.6, 33.33, 50, 66.66, 83.33, 100] > > ax > .set_xticks(xvals) > > ax > .set_xticklabels(['tick 0', 'tick 1', 'tick 2','tick 3', 'tick 4', 'tick 5', > 'tick 6']) > > ax > .set_ylabel(r'$\mu$text $\eta$text $\cdot$ m$^{-2}$ s$^{-1}$') > > ax > .set_yticklabels(['0', '200', '400', '600', '800', '1000', '1200', '1400']) > > ax > .plot(t2, color='black') > > ax > .fill_between(np.arange(0, len(t2)),t2,0, color='black', alpha=0.8) > > > > #from matplotlib import rc > #rc('font',**{'family':'sans-serif','sans-serif':['Arial']}) > #rc('text', usetex=True) > > table > = r'''\begin{tabular}{lccccccc}\hline&tick 0& tick 1 & tick 2 & tick 3 & tick > 4 & tick 5 & tick 6 \\\hline Vals & 32.00 & 3.28 & 5.80 & 5 & 8 & 45 & 7.3 > \\\hline \end{tabular}''' > > plt > .text(20,80,table,size=10) > > > plt > .show() > > Regards, > Arnaldo. > > --- > Arnaldo D'Amaral Pereira Granja Russo > Lab. de Estudos dos Oceanos e Clima > Instituto de Oceanografia - FURG > > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/_______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users