How can I display non-English characters in R-markdown? In an otherwise English document, I would like to render a single 'u' with two dots (an 'umlaut') on top of it. It is the correct spelling for 'u' in the name 'Muller.'
Asked
Active
Viewed 1.9k times
18
-
Thanks, I just tried `M\"uller` and `M \"u ller` , and `\"u` on its own line, and unfortunately it does not work. – ClarPaul Feb 27 '16 at 15:28
-
2See this question: http://stackoverflow.com/questions/26821326/how-can-i-write-special-characters-in-rmarkdown-latex-documents – Xiongbing Jin Feb 27 '16 at 15:39
-
1It all works if you "just" enter the proper Unicode character. See the answer I just added. – Dirk Eddelbuettel Feb 28 '16 at 02:22
2 Answers
15
We can do one better than in @RHertel answer. While the explicit use of HTML markup works, it may restrict us to HTML output -- which is uncool.
Checking with the RStudio documentation you see that UTF-8 is already the default (though I did an extra 'File -> Save with Encoding' which just showed that it already was at UTF-8). Hence it is just a matter of entering proper unicode characters. Below is a little variation on the standard file RStudio creates:
---
title: "Encoding Demo"
author: "Dirk Eddelbüttel"
date: "2/27/2016"
output: html_document
---
## R Markdown
Herr Müller sagt: "Über den Wolken können Sonnenuntergänge besonders schön sein."
which results in the following HTML:

Dirk Eddelbuettel
- 360,940
- 56
- 644
- 725
-
3Any experience with how the german 'Umlaute' can be pushed to the Rmarkdown if the text (ie the word containing the Umlaut) is part of a text in a data.frame or more precisely a tibble row/cell? – GWD Mar 24 '19 at 14:32
12
You can use standard HTML code for this.
For example, the German letter ä can be displayed by placing the corresponding vowel after an ampersand sign, followed by uml;
, i.e., ä
.
Here's an example of a .Rmd file:
---
title: "Umlauts with Rmarkdown"
output: html_document
---
## This is a sentence with many umlaut characters:
Herr Müller sagt: "Über den Wolken können Sonnenuntergänge
besonders schön sein."

RHertel
- 23,412
- 5
- 38
- 64
-
5
-
Since v1 of RStudio you can insert unicode characters in source files, even on Windows. – Phil Feb 07 '17 at 11:12