Pagedown: Change "Figure" to other languages in "Fig.cap'

Created on 11 Feb 2020  路  4Comments  路  Source: rstudio/pagedown

Hello!
I'm using the thesis_paged layout.
I have been tying to change the word "Figure" in the figure caption to portuguese, and tried some suggetions that works in bookdown, but i was not able to figure it out how to do this with pagedown.

Ex: this example is part of the thesis template.

`````

title: A paged html thesis template for R Markdown users
subtitle: A {pagedown} template.
author:

  • name: William Brent Thorne
    edu: BSc
    degree: Master of Documentation
    institute: Typeset University
    faculty: Reproducibility and FOSS
    department: Templates
    location: St. Catharines, ON
    date:
  • year: 2019
    month: August
    sign_page: true
    dedication: A dedication line or two goes here.
    abstract: This is the abstract.
    preface: A preface to the thesis.
    acknowledge: Put the ackknowledgements here.
    committee:
  • name: Jane Doe III
    prefix: Dr
    position: Chair of Department
  • name: John Smith
    prefix: Dr
    position: Faculty Advisor
    lof: true
    lot: true
    toc-title: Contents
    output:
    pagedown::thesis_paged:
    toc: true
    number_sections: yes
    pandoc_args: --mathjax
    self_contained: no
    bibliography: packages.bib
    link-citations: yes

uncomment this line to produce HTML and PDF in RStudio:

#knit: pagedown::chrome_print

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
fig.align = 'center')

## Second level heading

Here is some code and a plot, with a figure caption, Figure \@ref(fig:code):

```{r code, fig.cap='The automatic numbering of this figure will only work if it includes a figure caption, user beware!'}
plot(iris$Sepal.Length,
     iris$Sepal.Width,
     col = iris$Species,
     pch = 19)

```{r, include=FALSE}
knitr::write_bib(c('knitr', 'rmarkdown', 'xaringan'), 'packages.bib')

`````

A print screen of what is generated:
![](https://i.imgur.com/7mkQqkk.png)

**I would like to know if it's possible to change "Figure" to "Figura", and if it's possible, how can I do this.**

This is my session info:

xfun::session_info('pagedown')
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363), RStudio 1.2.5033

Locale:
LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
LC_TIME=Portuguese_Brazil.1252

Package version:
AsioHeaders_1.12.1.1 base64enc_0.1.3 BH_1.72.0.3 bookdown_0.17
digest_0.6.23 evaluate_0.14 glue_1.3.1 graphics_3.6.2
grDevices_3.6.2 highr_0.8 htmltools_0.4.0 httpuv_1.5.2
jsonlite_1.6 knitr_1.28 later_1.0.0 magrittr_1.5
markdown_1.1 methods_3.6.2 mime_0.8 pagedown_0.8
processx_3.4.2 promises_1.1.0 ps_1.3.0 R6_2.4.1
Rcpp_1.0.3 rlang_0.4.2 rmarkdown_2.1 servr_0.15
stats_3.6.2 stringi_1.4.4 stringr_1.4.0 tinytex_0.19
tools_3.6.2 utils_3.6.2 websocket_1.1.0 xfun_0.12
yaml_2.2.0
```

Thanks the maintainers!

Most helpful comment

Hi @beatrizmilz,

pagedown::thesis_paged() inherits bookdown's internationalization feature.
You need to create a _bookdown.yml file located in the same folder as your thesis Rmd file.

This YAML file should change _Figure_ into _Figura_:

language:
  label:
    fig: 'Figura '

Does it work with your configuration?

All 4 comments

Hi @beatrizmilz,

pagedown::thesis_paged() inherits bookdown's internationalization feature.
You need to create a _bookdown.yml file located in the same folder as your thesis Rmd file.

This YAML file should change _Figure_ into _Figura_:

language:
  label:
    fig: 'Figura '

Does it work with your configuration?

It worked!

Thank you so much @RLesur !

Hi, @RLesur

Does the same work with pagedown::html_paged?

Thank you all for the great package!

I think so as thesis_paged use html_paged which base format is bookdown::html_document2. Did you try already ?

Was this page helpful?
0 / 5 - 0 ratings