tikzDevice v0.12.4

[This article was first published on R on Ralf Stubner, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Yesterday tikzDevice version 0.12.4 made it unto CRAN and is now propagating to the mirrors.

The tikzDevice package provides a graphics output device for R that records plots in a LaTeX-friendly format. The device transforms plotting commands issued by R functions into LaTeX code blocks. When included in a paper typeset by LaTeX, these blocks are interpreted with the help of TikZ—a graphics package for TeX and friends written by Till Tantau.

In this release I finally merged PR #206 from Paul Murrell to make tikzDevice compatible with the graphics engine in R >= 4.1. And Dean Scarff made sure that tikzInfo->outColorFileName is always initialized (#200 fixing #199). In addition I have also added the current working directory is to TEXINPUTS (#203 fixing #197 and #198).

The main motivation for this release was a new WARNING on CRAN that could have triggered the removal of the package. (#219 fixing #218) The WARNING was triggered by the last remaining call to the standard C library function sprintf(). This function is insecure due to the possibility of buffer overflows, so it is a good idea to replace it with snprintf() where one needs the specify the number of characters to be printed. Normally this is straight forward, since one only has to call strlen() on all arguments and add the results. But in this case there is an integer number among the arguments, so I opted for taking the logarithm to determine the length:

    snprintf(tikzInfo->outFileName,
             strlen(tikzInfo->originalColorFileName) + floor(log10(tikzInfo->pageNum)) + 1,
             tikzInfo->originalFileName,
             tikzInfo->pageNum);
To leave a comment for the author, please follow the link and comment on their blog: R on Ralf Stubner.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)