在markdown中更改图的标题。

问题描述 投票:6回答:2

我目前正在用德语写一份小报告。因此,我希望我的图文标题能从原来的 图1图1 等等。

---
title: "Untitled"
author: "me"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
  pdf_document: default
---


```{r iris, fig.cap='Iris sepal lengths'}
hist(iris$Sepal.Length)
```

问题。 如何在R Markdown中更改默认的图题(不知道是不是真的这么叫)?

r latex r-markdown markdown pandoc
2个回答
4
投票

按照下面的例子,我想把标题从图1改成Abbildung 1,等等。这个问题你可以定义你自己的 tex 文件,在这里你可以更改图片标题的默认值。

header.tex文件。

\usepackage{caption}
\captionsetup[figure]{name=Abbildung}

这是主要的.Rmd文件。

---
title: "Untitled"
author: "me"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output: 
  pdf_document:
    includes:
      in_header: header.tex
---


```{r iris, fig.cap='Iris sepal lengths'}
hist(iris$Sepal.Length)
```

enter image description here


2
投票

如果你是用英语以外的其他语言写作,你可以用以下方法改变输出的pdf的语言选项 lang YAML选项。这将覆盖所有的标题,标签,目录等。

---
output: pdf_document
lang: de
---

```{r iris, fig.cap='Iris sepal lengths'}
hist(iris$Sepal.Length)
```

enter image description here

其他语言选项包括 fr (法文): it (意大利)等。见 http:/pandoc.orgMANUAL.html#language-variables。 更多细节。

© www.soinside.com 2019 - 2024. All rights reserved.