R Markdown-更改默认的pdf表标题前缀 [英] R Markdown - change default pdf table caption prefix
问题描述
用于在R Markdown pdf文档中获取表格标题的默认功能(示例Table: Table one
)非常好.但是我很难将默认的英语表格"更改为其他内容,同时又要保留位置(表格上方)和编号.编号是可以解决的,我可以编写自己的计数函数,但位置必须在表格上方.
The default function (example Table: Table one
) for getting table captions in your R Markdown pdf-documents is nice. But I struggle to change from default English "Table" to something else while at the same time keeping placement (above table) and numbering. Numbering is solveable, I could write my own count-function but placement have to be above the table.
我尝试使用Pander
设置新的前缀,但这似乎会破坏位置和编号.
I have tried to use Pander
to set a new prefix but that seems to break both placement and numbering.
有人对我应该做什么有任何想法吗,我可以更改默认表标题,同时(至少)保持默认位置在表上方,但最好同时保持编号吗?
Do anyone have any idea for what I should do, can I change the default table caption while (at minimum) keeping default placement above table but preferably keeping numbering as well?
推荐答案
您可以通过使用caption
Latex包并在单独的header.tex
文件中更改标题名称来做到这一点.然后告诉rmarkdown
包含它:
You can do so by using the caption
Latex package and changing the caption name in a separate header.tex
file. Then tell rmarkdown
to include it:
file.Rmd
---
output:
pdf_document:
includes:
in_header: header.tex
---
```{r cars}
knitr::kable(mtcars, caption = "This is a test")
```
header.tex
\usepackage{caption}
\captionsetup[table]{name=Test}
这篇关于R Markdown-更改默认的pdf表标题前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!