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

不打扰是莪最后的温柔 提交于 2021-02-05 06:05:34

问题


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:

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:

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):


回答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.




回答2:


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.



来源:https://stackoverflow.com/questions/59658664/germany-quotation-marks-broken-in-tinytex-rmarkdown-even-when-using-package-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!