0

I get the error message:

! Missing $ inserted.
<inserted text> 
                $
l.4 .... Graphic was created using BioRender.com.}
                                                  \label{fig:label} 

and am going absolutely bonkers trying to resolve the issue. The text in question is in a figure caption, and I have checked all my math expressions preceding the 'hinted' line. All my math expressions are correctly closed with $'s; I've removed all underscores (_); and I even removed a link to a website.

Is there a way for me to at least be directed to where the problem is located in my file?

I'm using Rmarkdown, papaja::apa6_pdf.

Kind regards to anyone who can help.

EDIT

Thanks for the responses.

I've managed to narrow down the problem. Here is a sample of the chunk I'm having issues with:

{r fig-label, include = TRUE, fig.cap="**This is the title of the image.** (**A**) Explanation A with a special character alpha $\\alpha$5.(**B**) Explanation B with a supercript degree symbol 60^o^C."}
if (Sys.info()[1]=="Windows"){
  knitr::include_graphics("C:\\Path\\To\\My\\Image\\File.png")
} else if (Sys.info()[1]=="Mac OS"){
  knitr::include_graphics("Path To My Image/File.png")
}

The problem arises with my supercripted degree symbol. Windows can effortlessly render the image to the correct size with all the text options (boldface, special characters, etc). My Mac fails to do so, and even removing the degree symbol makes my Mac include the ** around the text I want to have as boldface. Windows can make the image the correct size, Mac prints the image way too big.

I've followed all the debugging options explained at https://yihui.org/tinytex/r/#debugging.

I very much want (need) this to work on my Mac, so can anyone give me some advice on how I can get my mac to properly knit my markdown document?

Again, kind regards to anyone/everyone who is able to help or offer advice. Let me know if you need additional information.

  • 4
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. Right now we really have no idea what your code looks like so it's hard to say anything about what might be going on. Start a new document and add small chunks from your current document one at a time till you can isolate the error. – MrFlick Sep 12 '20 at 02:05
  • What triggered the error message? Please include some context. – Werner Hertzog Sep 12 '20 at 02:24
  • So I've tried a couple of things, and the document is able to knit without issue on Windows, but not on mac. Any thoughts regarding why this may be the case? – Andrew Almonte Sep 12 '20 at 03:40
  • @AndrewAlmonte The version of your tex package might be different. Handling of file names might also differ between operating system. Make a [mre] that fails on mac and we can have a look. – samcarter_is_at_topanswers.xyz Sep 12 '20 at 11:42

0 Answers0