9
votes

I am writing my first .rmd report using RMarkdown and then I knit it to pdf file. As I write it in my national language, I would like to have figures captions in my language too. The problem is that the default caption format is "Figure 1: My caption". I would like to change this generative "Figure 1:" part but I couldn't find how. Any help will be appreciated.

3

3 Answers

7
votes

Try specifying the language in the YAML header of an rmarkdown document (documentation link):

---
title: "Crop Analysis Q3 2013"
output: pdf_document
fontsize: 11pt
geometry: margin=1in
lang: german
---

The language code will be processed by the babel LaTeX package (at least in the case of pdflatex).

2
votes

I found out that it is possible to do using LaTeX:

---
title: "My raport"
output: 
  pdf_document:
    fig_caption: yes
header-includes:
   - \usepackage{caption}
---

\def\figurename{MyFigureName}

Still: is there any simpler way?

0
votes

It should work like this:

---
output: 
  pdf_document:
    fig_caption: true
---

```{r figWithCaption, echo=F, fig.cap="My Figure Caption"}
plot(cars) # your figure
```