小编Fáb*_*les的帖子

通过 rmarkdown 交叉引用章节编号或名称

试图在 Rmarkdown 中找到一种方法来交叉引用自动编号和/或通过其命名的章节来做类似的事情

"As I explained hundred pages ago in \ref{ch:Chapter_Label}....."
Run Code Online (Sandbox Code Playgroud)

然后生成的生成的 pdf 文档具有以下内容:

"As I explained hundred pages ago in Chapter 3....."
Run Code Online (Sandbox Code Playgroud)

或者

"As I explained hundred pages ago in <Chapter Name> ....."
Run Code Online (Sandbox Code Playgroud)

我在想一些机制,比如:

\chapter{My_Title} \label{ch:1}
Run Code Online (Sandbox Code Playgroud)

然后在我使用的文本中的任何地方,\ref{ch:1}我都会得到文本嵌入的“My_Title”或“Chapter 1”(或它获得的任何自动编号)。

Rmarkdown 似乎无法使用 hyperref 包,或者我遗漏了一些东西。

有人可以帮助我吗?

latex cross-reference pandoc knitr r-markdown

5
推荐指数
1
解决办法
2968
查看次数

如何将 R 格式表呈现为 pdf 输出以及如何在表格中显示百分比

我开始使用R formattable包,但仍然面临一些问题,无法formattable()正确输出 pdf 文档。

第一个问题:在应用任何color_*仅适用于数字类的函数后,如何获得百分比格式的数字?

从在R环境中执行/运行的代码中查看下表。

a<-formattable(x=a,list(A=color_bar("orange", 0.2),B=color_bar("orange", 0.2),C=color_bar("orange", 0.2),D=color_bar("orange", 0.2),E=color_bar("orange", 0.2)))
Run Code Online (Sandbox Code Playgroud)

假设a作为csv我输入的文件read.csv()

在此处输入图片说明

我想让“%”将数字粘贴在一起,同时将橙色条从 粘贴在一起formattable,但是如果我将 转换numericpercentby percent()fromscale或 by paste(a,"%",sep="")formattable 将无法正常工作numeric,需要进行指责。

第二个问题:渲染为 pdf 时,未正确创建来自呈现的块的此类表。我尝试使用formattable(a,list...), byprint(a)和 by 的直接输出,print(xtable(a))但没有任何效果。任何提示?

r knitr formattable

5
推荐指数
1
解决办法
6486
查看次数

标签 统计

knitr ×2

cross-reference ×1

formattable ×1

latex ×1

pandoc ×1

r ×1

r-markdown ×1