【发布时间】:2019-09-25 01:01:12
【问题描述】:
我想将本地目录中的图像/材料包含到 Xaringan remark.js 演示文稿中并调整它们的大小。 我正在通过 Mac 上的 Rmd/Rstudio 执行此操作。我希望能够按照Yihui's docs 中的建议使用宏来自定义大小
用于调整大小的建议宏不适用于我。
添加行:
.center[]
工作正常,但添加 beforeInit:“macros.js” 并将宏添加到该文件 knitting 会产生一个空白演示文稿
---
title: "A Cool Presentation"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
seal: true
self_contained: true
yolo: false
beforeInit: "macros.js"
nature:
autoplay: 30000
---
- Hello world
---
---
# new slide??
This works:
.center[]
---
But this does not work:
.center[]
Nor this
.center[![trachoma][:scale 50%](picsfigs/trachoma.jpg)]
one more slide
---
macros.js 文件:
remark.macros.scale = function (percentage) {
var url = this;
return '<img src="' + url + '" style="width: ' + percentage + '" />';
};
【问题讨论】: