gpt4 book ai didi

r - 德国引号在 tinytex/rmarkdown 中损坏 - 即使使用包 `csquotes`

转载 作者:行者123 更新时间:2023-12-04 12:22:13 27 4
gpt4 key购买 nike

我想要什么:

我想在 MacOS (Catalina) 上通过 rmarkdown 和 tinytex 在我的 TeX-PDF 中加入德语引号。参见示例:

enter image description here

问题:

它曾经按照指南工作 as proposed here .但是现在,它停止工作了。我只有英文引号,没有德文引号:

enter image description here

我尝试了什么,但没有成功:

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

R 代码:

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

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

session 信息:

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

编辑

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

\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}

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

enter image description here

最佳答案

感谢@NMarkgraf,我刚刚了解到这个解决方案确实有效:

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

因此,重点是添加一个值为 yes 的 YAML 变量 csquotes

关于r - 德国引号在 tinytex/rmarkdown 中损坏 - 即使使用包 `csquotes`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59658664/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com