4

I create a new document using the R Markdown Template American Economic Association journals. However, when knitting the whole document, my German Umlaute (such as ä, ü, Ö) are not displayed at all.

Reproducible example:

---
title: "Der Effekt von Ü auf Ö and ä"
short: "ä ü ö"
journal: "AER" # AER, AEJ, PP, JEL
month: "`r lubridate::month(Sys.time())`"
year: "`r lubridate::year(Sys.time())`"
vol: 1
issue: 1
jel:
  - A10
  - A11
keywords:
  - ö
author:
  - name: Öder Ügo
    firstname: Ö
    surname: Ügo
acknowledgements: |
  Acknowledgements
abstract: |
 ÖÄÜ
output: rticles::aea_article
---
Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98
BeSeLuFri
  • 623
  • 1
  • 5
  • 21
  • Possible duplicate of [How can I write special characters in RMarkdown latex documents?](https://stackoverflow.com/questions/26821326/how-can-i-write-special-characters-in-rmarkdown-latex-documents) – Jan van der Laan Jun 07 '18 at 09:57
  • @JanvanderLaan: No - not a duplicate, because this solution does not work for me – BeSeLuFri Jun 07 '18 at 10:08

1 Answers1

2

If you look at the resulting TeX file, you see the umlauts right there. The problem is just that by default LaTeX does not know how to deal with them. I see two possible solutions:

  • Make use of XeLaTeX via

    output: 
      rticles::aea_article:
        latex_engine: xelatex
    
  • Adjust the template.tex file to include \usepackage[utf8]{inputenc} in the preamble.

I would use the first approach. Either way you might have to post-process the resulting TeX file before submission: Replace all umlauts by the corresponding TeX commands (\"{U} etc.) and possbily remove the \usepackage.

In the future, this will work out of the box, since LaTeX will use UTF-8 by default!

Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75