在xaringan
演示文稿中,slideNumberFormat
参数通常设置为%current% / %total%
。可以在此参数中使用特定的幻灯片编号吗?
例如,如果我有这样的“最终”幻灯片:
---
name: mylastslide
# Thanks
后面有附录幻灯片,我想显示幻灯片编号,就像我的%current% / %mylastslide%
幻灯片编号一样。%mylastslide%
mylastslide
谢谢。
[在@user2554330 建议后编辑]
对于此代码,使用增量幻灯片,
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
institute: "RStudio, PBC"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
---
background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg)
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```
<script>
var slideshow = remark.create({slideNumberFormat : function (current, total) {
return 'Slide ' + current + ' of ' + (this.getSlideByName("mylastslide").getSlideIndex() + 1); },
highlightStyle: "github",
highlightLines: true,
countIncrementalSlides: false});
</script>
Image credit: [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Sharingan_triple.svg)
---
class: center, middle
# xaringan
---
hello
--
world
--
thanks
--
really
--
byebye
---
name: mylastslide
# Final slide
Install the **xaringan** package from [Github](https://github.com/yihui/xaringan):
```{r eval=FALSE, tidy=FALSE}
devtools::install_github("yihui/xaringan")
```
---
# Appendix
最后一张幻灯片(即附录)编号为Slide 6 of 9
(而不是Slide 6 of 5
),9 是 的url索引。mylastslide
(我+ 1
在slideNumberFormat
函数中使用,因为索引从 0 开始。)
谢谢。