title: Latex font style issues using amsmath and sfmath for plot labeling
body: <p>I have a question related to using TeX within python.</p>
  
  <p>I have the following packages enabled:</p>
  
  <pre><code>import numpy
  import matplotlib
  import matplotlib.pyplot as plt
  
  matplotlib.rc('text', usetex = True)
  matplotlib.rc('font', **{'family' : "sans-serif"})
  params = {'text.latex.preamble' : [r'\usepackage{siunitx}', r'\usepackage{sfmath}']}
  plt.rcParams.update(params)
  </code></pre>
  
  <p>The reason for this can be looked up in a <a href="https://stackoverflow.com/questions/22348756/upright-mu-in-plot-label-retaining-original-tick-fonts">previous question</a> of mine.</p>
  
  <p>However, I would now also be able to use the fonts of the <code>amsmath</code> package. When I include it in params, it does not respond. All I need <code>amsmath</code> for is to label the x-axis of a plot with "a".</p>
  
  <p>So to show you what I have:</p>
  
  <p><img src="https://i.stack.imgur.com/uvYkr.png" alt="enter image description here"></p>
  
  <p>and what I want (regarding the x-label):</p>
  
  <p><img src="https://i.stack.imgur.com/vfrOs.png" alt="enter image description here"></p>
  
  <p>Please note that to produce the second image, I changed <code>sfmath</code> into <code>amsmath</code>. This immediatly messes up the x- and y-ticks. This is something I do not want to happen.</p>
  
  <p>Is it perhaps possible to change the font style of a single letter/word to that of <code>amsmath</code>? This way I would be able to only use that font style when indicating the x-label of my figure.</p>
  
  <p>A different approach would be to replace <code>sfmath</code> by <code>amsmath</code> in <code>params</code> and make sure the ticks look like the first image.</p>
  
  <p>Thanks</p>
  
  <p>On a side note, the figures were created using:</p>
  
  <pre><code>fig = plt.figure()
  
  ax1 = fig.add_subplot(1, 1, 1)
  ax1.set_xlabel(r"$a$", fontsize = 14)
  
  plt.show()
  </code></pre>