1

I am building a tufte::tufte_html which should contain cross references to a figure. Unlucky me, I've been trying for a whole day for no avail.

Below, I also try with what has been suggested for bookdown version of pdf_document2. Any offerings of advice would be precious here.

---
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!
Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
dd_rookie
  • 331
  • 2
  • 3
  • 13

1 Answers1

0

You can use bookdown package. In this case you have to add the following "output" option in your yaml preamble:

output:
  bookdown::tufte_html2: default

This should work I think!