Reputation: 21
I am having problems when I run the following code:
for (i in as.vector(unidades$Unid_Fed)){
rmarkdown::render(input = "file.path/MR.Rmd",
output_format = "pdf_document",
output_file = paste("Texto_",i, Sys.Date(), ".pdf", sep='_'),
output_dir = "file.path/Multi_reports")}
---
and the MR.Rmd is:
---
title: "multiple pdf reports with special character ç í ã"
author: ''
date: ''
header-includes:
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\pagestyle{fancy}
\setlength\headheight{28pt}
\fancyhead[L]{\includegraphics[width=2.2cm]{ibge.png}}
\fancyfoot[LE,RO]{}
\usepackage{titling}
\pretitle{\begin{center}
\includegraphics[width=6cm]{ibge.png}\\[\bigskipamount]}
\posttitle{\end{center}}
\usepackage[utf8]{inputenc}
output: pdf_document
---
## Text - First part
\begingroup\Huge
\begin{center}
Other text using special characters like Ç í ã...
\end{center}
\endgroup
When I run this, I have output problems like this: ! Package inputenc Error: Unicode char \u8:Â not set up for use with LaTeX.
Error: Failed to compile D:/Users/...
Upvotes: 0
Views: 1208
Reputation: 21
I discovered: I just need to use encoding="UTF-8" in render:
for (i in as.vector(unidades$Unid_Fed)){
rmarkdown::render(input = "file.path/MR.Rmd",
output_format = "pdf_document",
output_file = paste("Texto_",i, Sys.Date(), ".pdf", sep='_'),
output_dir = "file.path/Multi_reports",
encoding="UTF-8")}
---
Upvotes: 1