79432965

Date: 2025-02-12 12:01:50
Score: 5
Natty:
Report link

@Bastián Olea Herrera Hi! Sorry for hijacking this question, but I was having this same problem and your answer worked for me! However, it's failing to actually print the plots. I'm using ggsurvminer and trying to print the plots from a list, like this:

```{r config, include=FALSE}
newslide <- function(content) {
  code <- deparse(substitute(content))

  cat(sep = "\n",
    knitr::knit_child(
      quiet = TRUE,
      text = c("```{r dpi=600, warning=FALSE, message=FALSE, echo=FALSE, results='asis', escape = TRUE}", #the r
    code, 
    "```")
      )
  )
}
```

```{r latex, echo=FALSE, results = 'asis', escape = "TRUE"}
for (cat in category){
  plot1 <- plot_list[[cat]]$plot

      newslide(
  content = {
        cat("\\begin{multicols}{2}\n")
        cat("\\noindent\n")
        print(table1_latex)
        cat("\\columnbreak\n")
        cat("\\begin{center}\n")
        print(plot1)
        cat("\n")
        cat("\\end{center}\n")
        cat("\\end{multicols}\n")
  }
)
}
```

I'm getting this error message:

! Missing $ inserted.
<inserted text> 
                $
l.561 ![](rewrite_
                  files/figure-latex/unnamed-chunk-19-1.pdf)<!-- --> 

Do you know what could be causing this? Thanks!

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (1): what could be
  • Whitelisted phrase (-1): worked for me
  • RegEx Blacklisted phrase (1): I'm getting this error
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • User mentioned (1): @Bastián
  • Looks like a comment (1):
  • Low reputation (1):
Posted by: carolinasc