
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/text_labels_and_annotations/usetex_fonteffects.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_text_labels_and_annotations_usetex_fonteffects.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_text_labels_and_annotations_usetex_fonteffects.py:


===================
Usetex font effects
===================

This script demonstrates that font effects specified in your pdftex.map
are now supported in usetex mode.

.. GENERATED FROM PYTHON SOURCE LINES 9-30



.. image-sg:: /gallery/text_labels_and_annotations/images/sphx_glr_usetex_fonteffects_001.png
   :alt: Usetex font effects
   :srcset: /gallery/text_labels_and_annotations/images/sphx_glr_usetex_fonteffects_001.png, /gallery/text_labels_and_annotations/images/sphx_glr_usetex_fonteffects_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt


    def setfont(font):
        return rf'\font\a {font} at 14pt\a '


    fig = plt.figure()
    for y, font, text in zip(
        range(5),
        ['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'],
        [f'Nimbus Roman No9 L {x}'
         for x in ['', 'Italics (real italics for comparison)',
                   '(slanted)', '(condensed)', '(extended)']],
    ):
        fig.text(.1, 1 - (y + 1) / 6, setfont(font) + text, usetex=True)

    fig.suptitle('Usetex font effects')
    # Would also work if saving to pdf.
    plt.show()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 1.332 seconds)


.. _sphx_glr_download_gallery_text_labels_and_annotations_usetex_fonteffects.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: usetex_fonteffects.ipynb <usetex_fonteffects.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: usetex_fonteffects.py <usetex_fonteffects.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: usetex_fonteffects.zip <usetex_fonteffects.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
