Skip to content

Describe possible need for loading the 'lmodern' package when using PGF files #20708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,10 @@ def _print_pgf_to_fh(self, fh, *, bbox_inches_restore=None):
%% Make sure the required packages are loaded in your preamble
%% \\usepackage{pgf}
%%
%% Also ensure that all the required font packages are loaded; for instance,
%% the lmodern package is sometimes necessary when using math font.
%% \\usepackage{lmodern}
%%
%% Figures using additional raster images can only be included by \\input if
%% they are in the same directory as the main LaTeX file. For loading figures
%% from other directories you can use the `import` package
Expand Down
6 changes: 6 additions & 0 deletions tutorials/text/pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@
using either the ``rasterized=True`` keyword, or ``.set_rasterized(True)`` as
per :doc:`this example </gallery/misc/rasterization_demo>`.

* Various math fonts are compiled and rendered only if corresponding font
packages are loaded. Specifically, when using ``\mathbf{}`` on Greek letters,
the default computer modern font may not contain them, in which case the
letter is not rendered. In such scenarios, the ``lmodern`` package should be
loaded.

* If you still need help, please see :ref:`reporting-problems`

.. _LaTeX: http://www.tug.org
Expand Down