This turns out to be a bug of tikzDevice
package, which has been reported long time ago (but still not fixed). The problem is the regular expression used to detect the pointsize was wrong (they should have used pt
instead of [pt]
):
> tikzDevice:::getDocumentPointsize
function (docString)
{
psLocation <- regexpr("\\d+[pt]", docString, ignore.case = T,
perl = T)
if (psLocation == -1) {
return(NA)
}
else {
pointsize <- substr(docString, psLocation, psLocation +
attr(psLocation, "match.length") - 2)
return(as.numeric(pointsize))
}
}
There are a number of ways to fix this problem. The best way is to fix it in tikzDevice
, of course. Before that happens, you can use this simple trick:
\documentclass[12pt,a4paper]{scrartcl}
That is, switch 12pt
with a4paper
so that 12
instead of 4
can be detected.