我的目标是使用Rmarkdown和.csl生成pdf数字参考书目。但是,无论我使用哪个.csl文件,引用的第一个单词都彼此略有不对齐。我怀疑它与乳胶的合理性有关,但我不知道它或Pandoc不够好以解决或修复它。理想情况下,我正在寻找一种在Rmarkdown中修复它的方法。据我所知,非数字样式不会发生这种情况。
MRE:
据我所知,首先获取一些数字的.csl文件是它们中的任何一个。 https://www.zotero.org/styles是一个很好的来源,很好的例子是自然(nature.csl),科学(science.csl)或生物医学中心(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:
我也尝试了不同的乳胶引擎无济于事。
sessioninfo:
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