首页 > 解决方案 > tikzDevice 主标题,不带粗体

问题描述

我最近开始在 R 中使用 tikzDevice 来创建要在 LaTeX 中编译的图。但是,我还没有找到摆脱主标题中的粗体字体的方法。

例如,我在 R 中创建了以下图表:

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

这会产生必要的 LaTeX 输出,但会引入{\bfseries Plot of $\hat{\beta}$}. 当像示例中一样,将普通字体的数学与粗体文本配对时,这尤其令人不快。我有兴趣\bfseries从 R 中删除,因为我需要在 for 循环中生成多个图。

标签: rlatextikzdevice

解决方案


tikzDevice只是翻译 R 图。在 R 中,标题默认为粗体。您可以使用以下方法更改font.main = 1

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

推荐阅读