# 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 ?

Hi Christophe,

Just renamed the graphics file. Works like a charm.

Kind regards,

Fritsander

1 Like