I often want to display both Latex and the underlying value of a variable in a ggplot title, but my existing methods seem to only work for one or the other.
library(tidyverse)
library(glue)
library(latex2exp)
MY_VARIABLE <- 1000
ggplot(mtcars, aes(x=wt, y=mpg)) +
geom_point() +
labs(title = TeX(r'(Can I use $\LaTeX$ with MY_VARIABLE)')))
MY_VARIABLE <- 1000
ggplot(mtcars, aes(x=wt, y=mpg)) +
geom_point() +
labs(title = glue('Can I use \\LaTeX with {MY_VARIABLE}'))



