2

I have recently started using tikzDevice in R to create plots to be compiled in LaTeX. However, I haven't found a way to get rid of the boldface font in the main caption.

As an example, I create the following graph in R:

library(tikzDevice)
tikz(file = 'example.tex', standAlone = TRUE)
plot(1, main = 'Plot of $\\hat{\\beta}$')
dev.off()

Which produces the necessary LaTeX output but introduces {\bfseries Plot of $\hat{\beta}$}. This is particularly unpleasant when, as in the example, math in normal font is paired with bold face text. I'm interested in removing the \bfseries from within R, as I need to produce several plots within a for loop.

Santiago
  • 37
  • 5

1 Answers1

2

tikzDevice just translates the R plot. And in R titles are in bold by default. You can change that using font.main = 1:

library(tikzDevice)
tikz(file = 'example.tex', standAlone = TRUE)
plot(1, font.main = 1, main = 'Plot of $\\hat{\\beta}$')
dev.off()
Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75