gpt4 book ai didi

r - 如何在标题中添加引号(bookdown)

转载 作者:行者123 更新时间:2023-12-04 17:24:09 26 4
gpt4 key购买 nike

我在使用 bookdown 时遇到字幕内的引号问题.以下rmarkdown doc说明了这个问题。

---
title: "testdoc"
author: "Dayne Filer"
date: "10/21/2020"
output:
pdf_document: default
html_document: default
---

In the main document, "quotation marks" are appropriately typeset.

```{r}
knitr::kable(matrix(1:2), caption = "In a caption, \"they are not\".")
```

```{r}
knitr::kable(matrix(1:2), caption = '"I did try some alternatives...".')
```

```{r}
knitr::kable(matrix(1:2), caption = '\`\`this works for latex, but not html.\'\'')
```
以上对 html 和 latex 都可以正确编译(最后一个表除外,它可以为 latex 正确编译,但不是 html)。但是,将文档正文复制到 bookdown 提供的“A Minimal Book Example”中没有排版正确的引号。我尝试使用 xelatex 和 pdflatex 来编译文档。对于 xelatex,它给出了以下内容:
enter image description here
pdflatex 给出:
enter image description here

最佳答案

正如 bookdown 所指出的作者,Yihui Xie , 在撰写长标题或带有特殊字符(例如引号)的标题时,作者应使用 text references .
在上面的例子中,它看起来像这样:

In the main document, "quotation marks" are appropriately typeset. 
And when using text references,

(ref:tabCap) "quotation" marks are properly formatted.

```{r}
knitr::kable(matrix(1:2), caption = '(ref:tabCap)')
```

关于r - 如何在标题中添加引号(bookdown),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64483993/

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