1

When I set text.usetex : True in my matplotlibrc and then try to add a text or label with \mathfrak{} I get an error (Undefined control sequence)

RuntimeError: latex was not able to process the following string:
b'$\\\\mathfrak{F}$'
...
*geometry* driver: auto-detecting
*geometry* detected driver: dvips
! Undefined control sequence.
<recently read> \mathfrak 
                          
l.19 {\rmfamily $\mathfrak
                          {F}$}
No pages of output.

Other font styles such as \mathcal{} work without issues.

Another thing that I tried was to set text.usetex : False and then specify that I want to use Computer Modern as the default font but seems like matplotlib is unable to find serif or sans-serif and falls back to DejaVu Sans:

findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.

Although in this last case, I can use \mathfrak{} without any problems.

Any ideas how to fix this? Thanks.

thepaips
  • 41
  • 5

1 Answers1

3

@samcarter_is_at_topanswers.xyz gave the answer that solves this.

Adding text.latex.preamble : \usepackage{amssymb} \usepackage{amsmath} to your .matplotlibrc does the trick.

thepaips
  • 41
  • 5