本文介绍了即使在使用软件包`csquotes`时,tinytex/rmarkdown中的德国引号也会损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要什么:

我想在MacOS(Catalina)上通过rmarkdown和tinytex在TeX-PDF中加德国引号.参见例如:

问题:

它曾经按照

我尝试过的事,没有成功:

  • 我更新了我的R包
  • 我更新了TeX软件包
  • 我检查是否已安装TeX软件包"csquotes"
  • 我将语言从"de"更改为"de-De"

R代码:

  ---标题:德国引号"输出:pdf_document:keep_tex:是的lang:de-DE标头包括:-\ usepackage {csquotes}---"Das ist sehrschön",sagte sie. 

sessionInfo:

  • R版本3.6.0(2019-04-26)
  • 平台:x86_64-apple-darwin15.6.0(64位)
  • 在以下操作系统上运行:macOS 10.15.2
  • tinytex v0.18
  • TeX 3.14159265(TeX Live 2019)

 通过名称空间(未附加)加载:[1]编译器_3.6.0 htmltools_0.4.0工具_3.6.0 yaml_2.2.0 Rcpp_1.0.3[6] rmarkdown_2.0 knitr_1.26 xfun_0.11摘要_0.6.23 packrat_0.5.0[11] rlang_0.4.2评估_0.14 

编辑

根据下面的@RalfStubner的建议,这是由上面的代码编译的TeX-File的最小可复制版本:

  \ documentclass [恩格曼]{文章}\ usepackage [shorthands = off,main = ngerman] {babel}\ title {德语引号}\作者{}\ date {\ vspace {-2.5em}}\ begin {document}\ maketitle``Das ist sehrschön'',sagte sie.\ end {document} 

代码确实可以编译-但是问题仍然存在(没有德语引号,只有英语引号):

解决方案

感谢@NMarkgraf,我才知道该解决方案确实有效:

  ---标题:德国引号"输出:pdf_document:keep_tex:是的lang:de-DEcsquotes:true#这是重要的行标头包括:-\ usepackage {csquotes}---"Das ist sehrschön",sagte sie. 

所以,关键是要添加一个YAML变量 csquotes ,其值是 yes .

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

解决方案

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.

这篇关于即使在使用软件包`csquotes`时,tinytex/rmarkdown中的德国引号也会损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 22:58