The tikzDevice R package is a great way to make figures with mathematical notation. I have used it extensively in previous papers, e.g.

Here is a screenshot of the MMIT figure, generated via this R script:

mmit-figure-2

The notation in the figure is consistent with the notation in the paper, because the figure is rendered via LaTeX at the same time as the paper.

So today on my Windows desktop I ran into the issue described in this stackoverflow post.

At least on my computer, the problem was due to missing LaTeX packages. I managed to fix it by creating a figures.tex file with the following header,

\usepackage{pgf,preview,everyshi,graphics,infwarerr,xcolor,tikz}

When I ran miktex on that file, it asked to install all of those packages. Then when I re-made the figure in R, everything worked fine.