Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Figure name in caption using RMarkdown

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.

like image 451
Marta Cz-C Avatar asked Jul 08 '15 11:07

Marta Cz-C


2 Answers

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).

like image 92
krlmlr Avatar answered Nov 07 '22 09:11

krlmlr


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?

like image 20
Marta Cz-C Avatar answered Nov 07 '22 09:11

Marta Cz-C