Search code examples
rlocalizationr-markdownquotestinytex

Germany quotation marks broken in tinytex/rmarkdown - even when using package `csquotes`


What I want:

I'd like to have German quotation marks in my TeX-PDF via rmarkdown and tinytex on MacOS (Catalina). See for example:

enter image description here

The problem:

It used to work following the guidelines as proposed here. But now, it stopped working. I only get English quotation marks, but not German ones:

enter image description here

What I tried, without success:

  • I updated my R packages
  • I updated TeX packages
  • I checked that the TeX package "csquotes" is installed
  • I changed the language from "de" to "de-De"

R-Code:

---
title: "German quotation marks"
output: 
    pdf_document:
        keep_tex: yes
lang: de-DE
header-includes:
    - \usepackage{csquotes}
---

"Das ist sehr schön", sagte sie. 

sessionInfo:

  • R version 3.6.0 (2019-04-26)
  • Platform: x86_64-apple-darwin15.6.0 (64-bit)
  • Running under: macOS 10.15.2
  • tinytex v0.18
  • TeX 3.14159265 (TeX Live 2019)
loaded via a namespace (and not attached):
 [1] compiler_3.6.0  htmltools_0.4.0 tools_3.6.0     yaml_2.2.0      Rcpp_1.0.3     
 [6] rmarkdown_2.0   knitr_1.26      xfun_0.11       digest_0.6.23   packrat_0.5.0  
[11] rlang_0.4.2     evaluate_0.14  

EDIT

Based on the @RalfStubner's suggestion below, here's the minimal reproducible version of the TeX-File that was compiled by the code above:

\documentclass[
  ngerman,
]{article}
\usepackage[shorthands=off,main=ngerman]{babel}


\title{German quotation marks}
\author{}
\date{\vspace{-2.5em}}

\begin{document}
\maketitle

``Das ist sehr schön'', sagte sie.

\end{document}

The code did compile - but the problem remained (no German quotes, only English quotes):

enter image description here


Solution

  • Thanks to @NMarkgraf I just learned that this solution does work:

    ---
    title: "German quotation marks"
    output: 
        pdf_document:
            keep_tex: yes
    lang: de-DE
    csquotes: true  # THIS IS THE IMPORTANT LINE
    
    header-includes:
        - \usepackage{csquotes}
    ---
    
    "Das ist sehr schön", sagte sie. 
    

    So, the point was to add a YAML-variable csquotes with value yes.