# How to use textrm with LaTeXStrings and the pyplot backend

**URL:** <https://discourse.julialang.org/t/how-to-use-textrm-with-latexstrings-and-the-pyplot-backend/82303>\
**Category:** General Usage\
**Tags:** question, plotting, latex, latexstrings\
**Created:** [June 6, 2022, 11:40am UTC](https://discourse.julialang.org/t/how-to-use-textrm-with-latexstrings-and-the-pyplot-backend/82303 "2022-06-06T11:40:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [June 6, 2022, 11:40am UTC](https://discourse.julialang.org/t/how-to-use-textrm-with-latexstrings-and-the-pyplot-backend/82303/1 "2022-06-06T11:40:28Z")

</div>

Hi all,

I am trying to use a combination of math and text symbols with LaTeXStrings and the pyplot backend of Plots.jl. Unfortunately, textrm does not work for some reason. Is there anything special I need to do, or is this a bug?

**MWE**

```julia
using Plots, LaTeXStrings

pyplot()

histogram(randn(1000), xlabel = L"\textrm{x}")

```

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [June 6, 2022, 1:13pm UTC](https://discourse.julialang.org/t/how-to-use-textrm-with-latexstrings-and-the-pyplot-backend/82303/2 "2022-06-06T13:13:34Z")

</div>

> [@Christopher\_Fisher](#):
>
> Unfortunately, textrm does not work for some reason.

Support for LaTeX in Pyplot is determined by the [mathtext rendering engine](https://matplotlib.org/3.1.1/tutorials/text/mathtext.html) used by Matplotlib, which supports only a subset of LaTeX math macros, not all of LaTeX.

In particular, it supports `\mathrm`, but not `\textrm`.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [June 6, 2022, 1:44pm UTC](https://discourse.julialang.org/t/how-to-use-textrm-with-latexstrings-and-the-pyplot-backend/82303/3 "2022-06-06T13:44:04Z")

</div>

Thanks for your reply. \mathrm actually works just fine for my purposes.
