Hello everyone.
I don't know if I'm in right place to ask but I'm just new to community.
I'm trying to use tufte package to write a PDF report, using Greek lang (compilation with knit). Although knit compiles the template correctly (in English), this isn't the case when I;m adding Greek words. Tried to add some Latex packages but still Greek words do not appear. The same packages work perfectly through Latex editors ( TexMaker). How can I write in Greek, in Rsudio? Is there a general quide to use?
Could you please share some code (at the very least, the YAML header) so we can see what may or may not be going wrong for you?
I'm not sure you'd be able to fully reprex this, but most of the guidance here still applies:
mara thanks for reply and sorry for delay. This is a portion of the code (I think the rest it's not important) :
---
title: "Tufte Handout"
subtitle: "An implementation in R Markdown"
author: "JJ Allaire and Yihui Xie"
date: "`r Sys.Date()`"
output:
pdf_document:
\usepackage{xgreek}
\usepackage{fontspec}
\usepackage{xunicode}
\setromanfont{FreeSerif}
\setsansfont{FreeSans}
tufte::tufte_book:
citation_package: natbib
latex_engine: xelatex
tufte::tufte_handout:
citation_package: natbib
latex_engine: xelatex
tufte::tufte_html: default
# pdf_document:
bibliography: skeleton.bib
link-citations: yes
---
```{r setup, include=FALSE}
library(tufte)
# invalidate cache when the tufte version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
options(htmltools.dir.version = FALSE)
# Introduction
Δοκιμη The Tufte handout style is a style that Edward Tufte uses in his books and handouts.
I just added the lines :
pdf_document:
\usepackage{xgreek}
\usepackage{fontspec}
\usepackage{xunicode}
\setromanfont{FreeSerif}
\setsansfont{FreeSans}
and the Greek word Δοκιμή (means test) in the beginning of the paragraph.
The compilation (knit) returns the error:
Error in yaml::yaml.load(string, ...) :
Parser error: while parsing a block mapping at line 1, column 1 did not find expected key at line 12, column 3
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load_utf8 -> <Anonymous> -> .Call
Execution halted
Please take into account that I'm new in both R and Latex (and also don't know how to use this post editor)
Thanks in advance.
Hi Alex,
Based on the Error output, it looks like there's a problem in your YAML at line 12. Which, I believe, is tufte::tufte_book:
. YAML is whitespace-sensitive, so it's possible your indentation there is off. I don't have the document, or the LaTeX packages necessary to build it, but you might want to take a look at what's going on with that. From eyeballing it, it looks like pdf_document:
is indented slightly more than the subsequent tufte::*
params.
Hope this helps.
Hello mara.
Thank you for your effort. I checked the detail you pointed but still doesn't work. I think I'm doing something wrong with syntax and the way Latex statements/commands have to be imported in the code. I have to study in more details the relevant documents.
Anyway, thank you again for your time.