Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Back in February the tikzDevice package became ORPHANED on CRAN. Consequently Kirill Müller and Yihui Xie searched for a new maintainer. When I read about it some time later, we decided that it makes sense for us to step in here. After a brief mail exchange with Yihui Xie the GitHub repository was transfered to our organization and can now be found at https://github.com/daqana/tikzDevice. Meanwhile I have implemented fixes for the existing warning messages from the CRAN checks and uploaded version 0.12, which is currently making its’ way onto CRAN. The next steps will be to work through the existing issues.

What can one do with the tikzDevice? It is a graphics device similar to pdf() or png(). But instead of an image file that might be included in a report as external graphic, it generates files in the TikZ format that makes LaTeX generate the graphic. This enables consistent fonts between text and graphics and TeX’s capabilities for typesetting mathematical equations within graphics. The pdf vignette contains many examples.

One can even use it in a R-markdown document. A document using

header-includes:
- \\usepackage{tikz}
- \\usepackage[osf]{mathpazo}


# c.f. https://github.com/daqana/tikzDevice/issues/60
library(knitr)
knit_hooks$set(plot = function(x, options) { if ("tikz" %in% options$dev && !options\$external) {
hook_plot_tex(x, options)
} else hook_plot_md(x, options)
})

library(tikzDevice)
options(tikzLatexPackages = c(
getOption("tikzLatexPackages"),
"\\usepackage[osf]{mathpazo}",
"\\usepackage[T1]{fontenc}",
"\\usepackage{textcomp}"
))


in a setup chunk will use the same fonts for text and graphics when those are created with dev = "tikz". In this example Palatino with text-figures:

Example Palatino with text-figures