gpt4 book ai didi

r - 改变书目风格

转载 作者:行者123 更新时间:2023-12-04 04:37:00 25 4
gpt4 key购买 nike

我正在使用markdown编写我的简历,并希望有多个书目部分(一个用于期刊文章,另一个用于书籍章节等)。我正在使用RefManagerR包来做到这一点,并且效果很好。

library("RefManageR")
BIB <- structure(list(structure(list(title = "Quantitative palaeotemperature records inferred from fossil pollen and chironomid assemblages from Lake Gilltjarnen, northern central Sweden", author = structure(list(structure(list(given = "K", family = "Antonsson", role = NULL, email = NULL, comment = NULL), .Names = c("given", "family", "role", "email", "comment")), structure(list(given = "SJ", family = "Brooks", role = NULL, email = NULL, comment = NULL), .Names = c("given", "family", "role", "email", "comment")), structure(list(given = "H", family = "Seppa", role = NULL, email = NULL, comment = NULL), .Names = c("given", "family", "role", "email", "comment"))), class = "person"), journal = "Journal of Quaternary Science", year = "2006", number = "8", pages = "831-841", volume = "21"), .Names = c("title", "author", "journal", "year", "number", "pages", "volume"), bibtype = "Article", key = "RID:0428130725771-5", dateobj = structure(1136070000, class = c("POSIXct", "POSIXt"), tzone = "", day.mon = 0L))), strings = structure(character(0), .Names = character(0)), class = c("BibEntry", "bibentry"))

NoCite(BIB)
PrintBibliography(BIB, .opts = list(style = "latex", bib.style = "authoryear",
sorting = "ydnt"))

在pdf中呈现为

Antonsson, K, S. Brooks and H. Seppa (2006). “Quantitative palaeotemperature records inferred from fossil pollen and chironomid assemblages from Lake Gilltjarnen, northern central Sweden”. In: Journal of Quaternary Science 21.8, pp. 831-841.



我想更改引用的样式。基本上,我想删除引号和 In:,并在名称后加上缩写。我知道样式是使用 tools::bibstyle设置的,我需要创建一个名为 formatArticle的例程,但是 tools::bibstyle的示例仅显示如何更改排序顺序,而我无法弄清楚如何查看默认的JSS样式。

请有人告诉我如何使用 bibstyle

另外,请有人告诉我如何使用rmarkdown内置的书目生成器在单个文档中创建多个书目部分,以便我可以使用csl文件。

最佳答案

仅在多个部分中回答有关书目的部分:
如果要“使用rmarkdown内置的书目生成器”进行操作,则需要更改用于从Rmarkdown文件生成pdf的 latex 模板。在YAML部分设置模板,如下所示:

output:
pdf_document:
template: mytemplate.tex

关于如何使用模板,有 references

一种更简单的方法是在RMarkdown文件本身中添加多个部分,然后打印出围兜。 .Rmd文件的示例:
---
title: "2 bibs"
output: pdf_document
---

```{r init, echo=FALSE}
library("RefManageR")

## loading some bib entries from example file
file <- system.file("Bib", "biblatexExamples.bib", package = "RefManageR")
BibOptions(check.entries = FALSE)
bib <- ReadBib(file)

## Gerating the entries for the 2 sections
bib1 = bib[[5:6]]
bib2 = bib[[7:8]]
```

Intro text.

# Bib 1

```{r, results='asis', echo=FALSE}
NoCite(bib1)
PrintBibliography(bib1, .opts = list(style = "markdown", bib.style = "authoryear", sorting = "ydnt"))
```

# Bib 2

```{r, results='asis', echo=FALSE}
NoCite(bib2)
PrintBibliography(bib2, .opts = list(style = "markdown", bib.style = "authoryear", sorting = "ydnt"))
```

关于r - 改变书目风格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46141683/

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