我试图在我的 Tufte Latex 文档中添加一个边注,该文档部分由 r 代码生成,但没有成功。设置为打印在页边距的代码块似乎只在其中放置图表,而不是文本或表格。如果其中包含内联代码,则调用的边距注释tufte::marginfigure()
会引发错误。边距图块忽略内联代码。我已经成功地让我的代码生成的文本打印在带有脚注的页边空白处,但是我得到了脚注编号,这是我不想要的。我想关闭那个脚注上的编号,但一直没能。
这是一个例子:
---
title: "Tufte Test"
author: "Neal"
date: "`r Sys.Date()`"
output:
tufte::tufte_handout: default
---
```{r setup, include=FALSE}
library(tufte)
library(tidyverse)
```
Here is some normal text with inline code: 2+3=`r 2+3`
\vspace{10pt}
```{r block, fig.margin=TRUE, echo=FALSE, results='asis'}
cat('Here is a margin code block with code-generated text and a plot.')
mtcars %>% ggplot(aes(mpg, disp)) + geom_point()
cat('The text stays in the main body.')
```
\vspace{10pt}
I can combine text and code in a footnote^[2+3=`r 2+3` \newline\vspace{10pt}], but I get footnote numbering, which I don't want.
```{marginfigure, echo=TRUE}
Here is a margin figure with inline code that doesn't work: 2+3=`r 2+3` \newline\vspace{10pt}
```
`r tufte::margin_note('This is a margin note. If I try to include inline code in it, I get an error because it "failed to tidy R code in chunk"')`
和输出:tufte-test.pdf
有任何想法吗?谢谢。