title: Annotate ggplot2 face labels with latex in R
body: <p>Given a sample dataset:</p>
  
  <pre><code>size = 10000
  dist = seq(0, 10, length.out=size)
  cohort.kv = list(A=3,B=40,C=44)
  cohort = sample(names(cohort.kv), size, TRUE)
  cohort.v = mapply(function(v) cohort.kv[[v]], cohort)
  across.kv = list(ONE=1,TWO=2,THREE=3)
  across = sample(names(across.kv), size, TRUE)
  across.v = mapply(function(v) across.kv[[v]], across)
  along.kv = list(FIVE=5, EIGHT=8, ELEVEN=11)
  along = sample(names(along.kv), size, TRUE)
  along.v = mapply(function(v) along.kv[[v]], along)
  df = data.frame(
    dist=dist, cohort=cohort, across=across, along=along,
    value=sin(dist/across.v+cohort.v)*along.v
  )
  df$across = factor(df$across, levels=names(across.kv))
  df$along = factor(df$along, levels=names(along.kv))
  </code></pre>
  
  <p>I am trying to add latex into the facet labels. <a href="https://stackoverflow.com/a/40528496">This answer</a> explains how to add latex to ggplot labels. The code below produces a faceted ggplot with latex in the axis labels, and modified facet labels.</p>
  
  <pre><code>library(ggplot2)
  # install.packages("latex2exp", dependencies=TRUE)
  library(latex2exp)
  (
    ggplot(df, aes(x=dist, y=value, color=cohort))
    + geom_line()
    + facet_grid(
      rows=vars(across),
      cols=vars(along),
      labeller=labeller(
        across=c(ONE="UNO",TWO="DOS",THREE="TRES"),
        along=c(FIVE=TeX("$V_5$"),EIGHT=TeX("$V_8$"),ELEVEN=TeX("$V_11$"))
      )
    )
    + xlab(TeX("Distance ($\\delta$)"))
    + ylab(TeX("Intensity ($\\alpha$)"))
  )
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dloQN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dloQN.png" alt="Plot result"></a></p>
  
  <p>The line <code>along=c(FIVE=TeX("$V_5$"),EIGHT=TeX("$V_8$"),ELEVEN=TeX("$V_11$"))</code> should change the top facet labels at the top, but it does not.</p>
  
  <p>How can I add latex to face labels?</p>