This question could be linked to this, this and this. However, I opened a new one because I tried two different options from the suggestions and getting different results.
The aim is to get consistent font in latex document (scrbook) when graphs/diagrams are plotted using R. I see two basic approaches.
1) Using tikzDevice and following piece of code
library(tikzDevice)
tikz("rtikzFile.tex" )
plot(1,1,xlab="Real count")
dev.off()
this generates a rtikzFile.tex file which I include with the main.tex file. This works nicely. However, I have many contour, spatial plots, for which the tex file could be really really big. I heard from a colleague of mine that TeX also have a word limit for compilation (though it is a very high value but for a phd thesis with tikzDevice it could be achievable.)
Output --
2) Using extrafont in R and following piece of code
library(extrafont)
loadfonts()
pdf("extrafontR.pdf",family="CM Roman")
plot(1,1,xlab="Real count")
dev.off()
I have installed the CM Roman fonts as instructed here. Output --
Now, if I compare the results of the two approaches, the font looks different. I checked this with Mac Preview and Acrobat Reader. This looks completely wrong in default viewer of TeXStudio (less important). I am more concern for the fonts in pdf viewer. I would like to get the same output as in approach 1) but using approach 2). This way, I will have more control on my figures and compile time for tex will be lesser.
My questions are --
- Am I using correct font and settings?
- Is this to do with my pdf viewer? OR
- Should I ask this ok SO instead?**
P.S. My knowledge about fonts is very limited.

