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

    Click :ref:`here <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 Fonteffects
==================

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




.. image:: /gallery/text_labels_and_annotations/images/sphx_glr_usetex_fonteffects_001.png
    :class: sphx-glr-single-img





.. code-block:: python


    import matplotlib
    import matplotlib.pyplot as plt
    matplotlib.rc('text', usetex=True)


    def setfont(font):
        return r'\font\a %s at 14pt\a ' % font


    for y, font, text in zip(range(5),
                             ['ptmr8r', 'ptmri8r', 'ptmro8r',
                              'ptmr8rn', 'ptmrr8re'],
                             ['Nimbus Roman No9 L ' + x for x in
                              ['', 'Italics (real italics for comparison)',
                               '(slanted)', '(condensed)', '(extended)']]):
        plt.text(0, y, setfont(font) + text)

    plt.ylim(-1, 5)
    plt.xlim(-0.2, 0.6)
    plt.setp(plt.gca(), frame_on=False, xticks=(), yticks=())
    plt.title('Usetex font effects')
    plt.savefig('usetex_fonteffects.pdf')


.. _sphx_glr_download_gallery_text_labels_and_annotations_usetex_fonteffects.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
