Cross reference knitr tufte

What is the correct way to get knitr to cross-reference? The recommended approach in the documentation (see below) does not work for me. I am writing a book with a bookmark and the tufte_book template. I cannot get cross references to numbers (or tables) to work correctly. I put in a small clip that constantly does not allow me to update cross-references in the document. Im running R 3.2.3 on x86_64-apple-darwin13.4.0. I know that this question has already been answered, but all the answers do not work the same. No, I do not want to use bookdown.

---
title: "Cross-references SNAFU"
output:
  tufte::tufte_book:
    citation_package: natbib
    latex_engine: xelatex
---
```{r ch3-inits, include=FALSE}
library(tufte)
library(knitr)
knitr::opts_chunk$set(eval.after = 'fig.cap') 

```
\chapter{Not Working Cross References, the beginning \label{chap:alpha} }

```{r t-test, fig.cap=paste('$2 \\times 2$ is', 2*2), fig.height=2.5}
x = rnorm(30)
par(mar=c(4, 4, .1, .1))
hist(x, main='')
```


Here is the reference to that Figure \ref{fig:t-test}.  NOT.

Here's the exit video: PDF final output

+4
source share
1 answer

- keep_tex: true YAML, (La) Tex Rstudio. , . , , , , .

0

Source: https://habr.com/ru/post/1652100/


All Articles