有什么正确的方法可以让knitr做交叉引用呢?文档中推荐的方法(见下文)对我不起作用。我正在写一本书与针织和tufte_book模板。我似乎不能让图形(或表格)的交叉引用正常工作。我附上了一个小片段,它始终无法更新文档中的交叉引用。我在x86_64-apple-darwin13.4.0上运行R 3.2.3。我知道这个问题以前已经回答过了,但是所有的答案都以同样的方式失败了。不,我不想用bookdown。
---
title: "Cross-references SNAFU"
output:
tufte::tufte_book:
citation_package: natbib
latex_engine: xelatex
---
```{r ch3-inits, include=FALSE}库(Tufte)
库(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.下面是输出的一个剪辑:resultant pdf output
发布于 2016-10-11 06:50:05
这个问题的解决方案是在YAML中设置keep_tex: true,然后在RStudio外部单独运行(La)Tex文件。我知道这很傻,但它很管用。仍然不知道为什么它会与多个子文档混淆,但对我来说似乎是这样。
https://stackoverflow.com/questions/39086094
复制相似问题