Spanish accents disappear from figures but show up properly on paragraphs
sebastianvelez opened this issue · comments
---
title: 'Some title'
author: 'This be me'
date: '`r format(Sys.Date(), "%B %Y")`'
lang: es
header-includes:
- \usepackage{tikz}
output:
pdf_document:
fig_caption: yes
---
```{r global options, echo = F, message=F}
library(knitr)
opts_chunk$set(fig.width=6, fig.height=3.5, dev = 'tikz')
```
I have some paragraphs that include cool accents like áspid.
If I run the next chunk in the R console I see the accent on the figure it generated. But the accent is
missing in the pdf.
```{r}
plot(pressure, main= "áspid")
```
Thanks. Can you please install the development version and show the output of tikzDevice::tikzTest()
?
After reading an answer to this particular Stack Overflow post - Producing pdf with knitr and Rmarkdown: accents in text show up but not in figures. - it seems that this question was double posted.
Here is how I took the advice from Stack Overflow to resolve @sebastianvelez's issue:
---
title: 'Some title'
author: 'This be me'
date: '`r format(Sys.Date(), "%B %Y")`'
lang: es
output:
pdf_document:
fig_caption: yes
---
```{r global options, echo = FALSE, message = FALSE}
# install this particular package from GitHub
devtools::install_github( repo = "daqana/tikzDevice" )
# load necessary packages
library( knitr )
library( tikzDevice )
# requesting xelatex instead of the default LaTeX engine does seem to work
# thank you to SO for this answer
# https://stackoverflow.com/a/46220592/7954106
options( tikzDefaultEngine = "xetex" )
# set figure dimensions
opts_chunk$set( fig.width = 6, fig.height = 3.5 )
I have some paragraphs that include cool accents like áspid.
If I run the next chunk in the R console I see the accent on the figure it generated. But the accent is
missing in the pdf.
plot( x = pressure, main = "áspid" )
Hi @sebastianvelez, using options( tikzDefaultEngine = "xetex" )
should indeed solve this, thanks @cenuno!
Closing this issue since it appears to be resolved. Please feel free, if this is still an issue, to leave a comment requesting this issue be reopened.