tikzDevice main caption without boldface

114 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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()