# tikzDevice on windows

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

- Figures 1-2 of A log linear-time algorithm for constrained changepoint detection
- Figure 3 of Generalized Functional Pruning Optimal Partitioning (GFPOP) for Constrained Changepoint Detection in Genomic Data
- Figure 2 of Maximum margin interval trees

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

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.