'Missing $ inserted' error message when converting jupyter notebook to pdf with nbconvert

For me it was another, although related issue: underlines. I assume that the cause is that text in cells marked as Raw Text will be passed directly to LaTeX, where it can be interpreted as LaTeX code itself. Maybe the underlines in your figure's name?

  • At some point, I had a raw cell with three underlines ___ which were then making the conversion break. The temporary solution was to convert the cell to markdown, instead of raw (and not run it) to appear in the pdf.

To find the error, I used the following conversion (taken from this answer):

jupyter nbconvert thenotebook.ipynb --to latex
  • Another error, related, was caused by a link containing underlines:
[text](https://en.wikipedia.org/wiki/Python_(programming_language))

This was also in a Raw Text cell, which I converted to markdown to generate the pdf. The format (colors, links) are different, though.

  • Last note: My file's name also contains empty spaces, but that wasn't an issue at all!