3

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

Sebastian Sauer
  • 1,555
  • 15
  • 24
  • With `keep-tex: yes` you get a `.tex` file you can inspect independently: 1. Verify that compiling the `.tex` reproduces the issue. 2. Produce a [mre] by removing anything from the `.tex` file that is not needed to reproduce the issue. 3. [Edit] your question to include the minimal `.tex`. – Ralf Stubner Jan 09 '20 at 07:18
  • BTW, this reduction makes sense only if the bare minimum for a working solution is present in the `.tex` file: packages `babel` and `csquotes` as well as option `ngerman`. – Ralf Stubner Jan 09 '20 at 09:36

2 Answers2

1

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.

Sebastian Sauer
  • 1,555
  • 15
  • 24
  • Interesting. Which `pandoc` version do you use? Do you sill need the `header-includes`? For me the `csquotes: true` header does nothing. – Ralf Stubner Jan 09 '20 at 17:31
  • It's strange, and new to me too. pandoc version: `rmarkdown::pandoc_version() [1] ‘2.9.1’`. Not 100% convinced though which version RStudio actually draws upon, as RStudio comes shipped with some pandoc in some version. – Sebastian Sauer Jan 12 '20 at 15:25
  • The version found this way is the version used for processing. This is considerably newer than the version I am using (2.5), which probably explains the different behavior. – Ralf Stubner Jan 12 '20 at 16:11
1

I was dealing with this issue as well. The YAML description states that

if your LaTeX template or any included header file call for the [csquotes] package, pandoc will detect this automatically and use \enquote{...} for quoted text.

So you actually only need to add

csquotes: true  # THIS IS THE IMPORTANT LINE

There's no need to add

    - \usepackage{csquotes}

at least this works for me.

JKR
  • 11
  • 2