在tufte_html中交叉引用数字

时间:2018-02-05 01:55:16

标签: html r knitr bookdown tufte

我正在构建一个tufte::tufte_html,它应该包含对图形的交叉引用。不幸的是,我一整天都在尝试无济于事。

下面,我还尝试了bookdown pdf_document2版本的建议。任何提供的建议都很珍贵。

---
title: "Repro cross-referencing"
subtitle: "A how to guide"
author: "Deependra Dhakal"
date: "`r Sys.Date()`"
output:
  tufte::tufte_html: default
link-citations: yes
---

```{r setup, include=FALSE}
library(tufte)
# invalidate cache when the tufte version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
options(htmltools.dir.version = FALSE)
```

# Introduction

This is just an example

```{r examp-fig, fig.width=10, fig.cap="\\label{fig:examp-fig}Not a good caption"}

plot(2:5, 5:8)
```


## Try referencing here

Through the figure [@fig:examp-fig], I am trying to demonstrate how cross referencing works. But apparently this doesn't work.

Is this any better? The figure \@ref(fig:examp-fig) is being referenced here. Naaah!

1 个答案:

答案 0 :(得分:0)

您可以使用预订套件。在这种情况下,您必须在yaml序言中添加以下“输出”选项:

output:
  bookdown::tufte_html2: default

我认为这应该有效!