Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underscore in names causes TeX error #202

Open
potash opened this issue Dec 26, 2019 · 2 comments
Open

Underscore in names causes TeX error #202

potash opened this issue Dec 26, 2019 · 2 comments

Comments

@potash
Copy link

potash commented Dec 26, 2019

I am trying to compile the following Rmd file:

    ---
    output: pdf_document
    ---
   
    ```{r dev='tikz'}
    library(ggplot2)
    df <- expand.grid(x = 0:5, y = 0:5)
    df$z <- runif(nrow(df))
    # default is compatible with geom_tile()
    ggplot(df, aes(x, y, fill = z)) + geom_raster()
    ```

I get the following error:

! Missing $ inserted.
<inserted text> 
                $
l.69 ...interpolate=false]{unnamed-chunk-1-1_ras1}
                                                  }; 

Quitting from lines 6-11 (test.Rmd) 

I believe the issue is that the chunk is generating a helper raster file and using the suffix "_ras1" but TeX uses underscore for subscripts. I don't know if this is an issue in tikzDevice or elsewhere in the Rmarkdown toolchain. Appreciate your help.

@rstub
Copy link
Member

rstub commented Dec 28, 2019

This has been asked on SO: https://stackoverflow.com/q/58401825/8416610 Unfortunately I have not found a solution for it at the time. I will look again.

@rstub
Copy link
Member

rstub commented Jan 22, 2020

@potash The current development version of knitr solves this problem for me. Can you please verify on your end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants