|
From: mogliii <mo...@gm...> - 2012-08-15 13:09:22
|
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 15/08/2012 09:56, Mogliii wrote:<br>
</div>
<blockquote cite="mid:502...@gm..." type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
I get the attached result. The \texttt{} is rendered differently
by matplotlib and latex.<br>
<br>
I am using the default latex fonts, and below is my preamble.<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
rc('font', **{'family':'serif', 'serif':['Computer Modern
Roman']})<br>
params = {'backend': 'pdf',<br>
'axes.labelsize': 12,<br>
'text.fontsize': 12,<br>
'legend.fontsize': 12,<br>
'xtick.labelsize': 10,<br>
'ytick.labelsize': 10,<br>
'text.usetex': True,<br>
'figure.figsize': fig_size,<br>
'axes.unicode_minus': True}<br>
matplotlib.rcParams.update(params)<br>
<br>
<br>
<br>
What do I have to change to match the font?<br>
</blockquote>
Found the solution.<br>
The default font of matplotlib is Courier, but LaTeX rendered with
Computer Modern Typewriter<br>
<br>
Changing the first line makes matplotlib use the same font.<br>
<pre class="lang-tex prettyprint"><code><span class="pln">rc</span><span class="pun">(</span><span class="pln">'font', **</span><span class="pun">{</span><span class="pln">'family':'serif', 'serif':</span><span class="pun">[</span><span class="pln">'Computer Modern Roman'</span><span class="pun">]</span><span class="pln">,
'monospace': </span><span class="pun">[</span><span class="pln">'Computer Modern Typewriter'</span><span class="pun">]})</span></code></pre>
</body>
</html>
|