Use computer modern (cm) font in math mode in text (Solved)

Problem:

  • In Sources->Text, or any Colorbar legend title, using a latex math expression like J_z gives a sans-font-like result, instead of latex default computer modern that is shown in some official references. Switch the font to “Times” does not make a difference.

Result:

paraview-math

Desired result:

latex-default-itatic-serif

Version:

ParaView-5.8.1-MPI-Linux-Python3.7-64bit
ParaView-5.9.0-MPI-Linux-Python3.8-64bit

Thoughts

According to matplotlib document, to revert to the old behavior set the:

mpl.rcParams['mathtext.fontset'] = 'cm' 
mpl.rcParams['mathtext.rm'] = 'serif'

or set:

mathtext.fontset: cm
mathtext.rm : serif

in your matplotlibrc file.

Update (solved):

  • I modified the file ParaView-5.9.0-MPI-Linux-Python3.8-64bit/lib/python3.8/site-packages/matplotlib/mpl-data/matplotlibrc to uncomment and modify the following options:

    mathtext.fontset: cm
    mathtext.rm : serif

Now the text in Paraview uses the classic latex computer modern fonts.
paraview-math-cm

2 Likes

@LfxPaul: FYI