Error when running knitr after update of RStudio and R

I suddenly run into the following error:

! Missing $ inserted.
<inserted text> 
$
l.87 ...egraphics[width=150pt]{LPI Planning_Control}
                                                   \end{flushright}

Try to find the following text in Factuur-week.Rmd:
  ...egraphics[width=150pt]{LPI Planning_Control} 

You may need to add $ $ around a certain inline R expression `r ` in Factuur-week.Rmd (see the above hint). See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Error: LaTeX failed to compile Factuur-week.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Factuur-week.log for more info.
Execution halted

Don't have a clue what happened.

Thanks.

I believe this is an issue because you have a _ in your filename. LaTeX does not handle this well as _ is a special character in TeX so you need to escape. It is for math mainly, hence the advice with $

This is a known issue in LaTeX. It is recommended to use dash in file path and labels for example to avoid this type of error

Can you try after renaming your file ?

Glad it worked!

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Hi Christophe,

Just renamed the graphics file. Works like a charm.

Thanks a lot for your very fast reply!

Kind regards,

Fritsander

1 Like