r - 数字 .csl 样式导致 RMarkdown 中 pdf 书目错位
问题描述
我的目标是使用 Rmarkdown 和 .csl 在 pdf 中生成数字参考书目。但是,无论我使用哪个 .csl 文件,引用的第一个单词都彼此略微错位。我怀疑它与乳胶的合理性有关,但我不知道它或 pandoc 足以弄清楚或修复它。理想情况下,我正在寻找一种在 Rmarkdown 中修复它的方法。据我所知,非数字样式不会发生这种情况。
MRE:
首先获取一些数字 .csl 文件,据我所知,它们中的任何一个都会发生这种情况。https://www.zotero.org/styles是一个很好的来源,很好的例子是 Nature (nature.csl)、Science (science.csl) 或 Biomed Central (biomed-central.csl)。
然后运行它来生成一个示例围兜:
knitr::write_bib(c("knitr", "stringr", "ggplot2"), "test.bib")
然后编织这个 Rmd 文件:
---
title: "test"
output: pdf_document
bibliography: test.bib
csl: biomed-central.csl # whatever numeric .csl
---
# Citations
@R-ggplot2 @R-knitr @R-stringr @ggplot22016 @knitr2015 @knitr2014
# References
结果:
使用 biomed-central.csl:
使用 nature.csl(轻微但仍然存在):
使用science.csl:
我也尝试过不同的乳胶引擎,但无济于事。
会话信息:
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.3 purrr_0.3.3 readr_1.3.1 tidyr_1.0.0 tibble_2.1.3 ggplot2_3.2.1 tidyverse_1.3.0 rmarkdown_2.1.1
[11] knitr_1.27 here_0.1
loaded via a namespace (and not attached):
[1] tinytex_0.19 tidyselect_0.2.5 xfun_0.12 haven_2.2.0 lattice_0.20-38 colorspace_1.4-1 generics_0.0.2 vctrs_0.2.1 htmltools_0.4.0 yaml_2.2.0
[11] rlang_0.4.2 pillar_1.4.3 withr_2.1.2 glue_1.3.1 DBI_1.1.0 dbplyr_1.4.2 modelr_0.1.5 readxl_1.3.1 lifecycle_0.1.0 cellranger_1.1.0
[21] munsell_0.5.0 gtable_0.3.0 rvest_0.3.5 evaluate_0.14 labeling_0.3 fansi_0.4.1 highr_0.8 broom_0.5.3 Rcpp_1.0.3 scales_1.1.0
[31] backports_1.1.5 jsonlite_1.6 farver_2.0.3 fs_1.3.1 hms_0.5.3 digest_0.6.23 stringi_1.4.4 grid_3.6.2 rprojroot_1.3-2 cli_2.0.1
[41] tools_3.6.2 magrittr_1.5 lazyeval_0.2.2 crayon_1.3.4 pkgconfig_2.0.3 zeallot_0.1.0 ellipsis_0.3.0 xml2_1.2.2 reprex_0.3.0 lubridate_1.7.4
[51] assertthat_0.2.1 httr_1.4.1 rstudioapi_0.10 R6_2.4.1 nlme_3.1-142 compiler_3.6.2
解决方案
推荐阅读
- nginx-config - 在 Nginx 的位置过滤并指定 html 文件
- c++ - 封闭类可以访问嵌套类吗?
- mysql - 如何使用 ORDER BY 实现 group_concat
- model-view-controller - ASP.NET Core 2.2 MVC 并没有太大的文件上传
- .net - 拥有测试基类的最佳实践 - .NET
- python - 如何将用户重定向到odoo中的登录页面?
- vba - VBA Transfer Spreadsheet 不会将 mmm-yy 解析为 Access 表中的正确日期值
- apache-spark - PySpark 使用 google colabs 连接问题连接到 Cassandra
- angular - Angular 12使用组件中的管道
- javascript - PHP 输出不能被 Javascript 切片