我无法使用RMarkdown,华夫饼包和字形
来编译PDF如果我使用TIKZ设备或PDF渲染,则无关紧要。该文档可以毫无问题地编译为HTML。
我现在能想到的唯一工作就是使用HTML编译器创建SVG图形,然后在我的中间.TEX文件中引用这些文件。
请注意,如果您只是运行代码行下方的代码," ## ---- waffle_figure ----"。它应该创建图表,前提是您installed the fontawesome font on your system,在R中安装 extrafont 包,然后运行 font_install()命令。
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
cssmin: {
combine:{
files:{
'Project/css/main.css': [ 'file-upload.css']
}
}
}
});
grunt.LoadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['cssmin'])
};
答案 0 :(得分:1)
华夫饼包现已更新!现在,石英和开罗设备都使用knitr / rmarkdown。很棒的谢谢你应该归功于Bob Rudis和Dave Gandy。
修订后的代码包括latin modern(LaTeX)字体,以证明可以在华夫饼图中实现乳胶字体和fontawesome字形。
为了使代码有效,您必须先从各自的网站安装 lmroman10-regular-webfont.ttf 和 fontawesome-webfont.ttf :{{3 }和Click on the webfont kit link。
title: "Waffle"
output:
pdf_document:
latex_engine: xelatex
html_document: default
header-includes:
- \usepackage{fontspec}
- \defaultfontfeatures{Extension = .otf}
- \usepackage{fontawesome}
- \usepackage{tikz}
---
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(warning = FALSE, error = FALSE, message = FALSE, results='hide', echo = FALSE, dev = "tikz", external = TRUE)
```
## Font Awesome Gyphy
Font awesome glyphs are easy to integrate into the main text. For example: \faTwitter.
## Waffle Plot
You can also embed plots with glyphs and custom fonts, for example: \newline
```{r pressure, echo=FALSE, dev="quartz_pdf", dev.args=list(family = "Helvetica")}
## ---- waffle_figure ----
loadpackages <- function(package.list = c("ggplot2", "Rcpp")) {
new.packages <- package.list[!(package.list %in% installed.packages()[,"Package"])]
if (length(new.packages)){install.packages(new.packages, repos = 'http://cran.us.r-project.org')}
lapply(eval(package.list), require, character.only = TRUE)}
loadpackages(c("waffle", "extrafont", "grid", "gridExtra"))
# font_import() # Run this command, type "y", and press enter after installing new fonts.
parts <- c(40, 30, 20, 10)
waffle(parts,
rows=10,
use_glyph = "user",
glyph_size = 7)+ggtitle("Some Sample Text Here")+
theme(plot.title = element_text(family="LM Roman 10"))
```