1. 使用 RMarkdown 的 child 参数,进行文档拼接。
  2. 这样拼接以后的笔记方便复习。
  3. 相关问题提交到 Issue

1 RMarkdown和bibtex

RMarkdown中可以使用文献引用功能。

  • 在文中使用,[@author]其中authorbibTex文档的编码,这个等会介绍。
  • bibTex常见后缀是.bib,一般的学术网站可以查到。
    • 百度学术为例,每个文献都会有个<>的符号点击BibTex
  • 其他问题可以参考(Layton 2015)

2 bibtex的介绍

The entry of a reference in the BibTEX program consists of three mandatory parts –

  1. type of the reference,
  2. a user-defined citation key which can be used for citing the reference, and
  3. detail of the reference. (Datta 2017, 141)

bibtex的例子包含三部分, (1)是类型, (2)是用户自定义的引用标签,没有格式要求1。 (3)是改参考文献的具体内容。

3 主要匹配清单

(Datta 2017, 142)总结了bibtex主要的类型和内容的匹配清单。

4 types 主要的类型

  • article (articles in journals or magazines),
  • book (books),
  • booklet (booklet type references),
  • inbook (chapters or parts of books),
  • incollection (parts of a book with separate titles),
  • inproceedings (articles in conference proceedings),
  • conference (articles in conference proceedings),
  • manual (technical documentations),
  • mastersthesis (Master degree theses),
  • phdthesis (Ph.D theses),
  • misc (uncommon references),
  • proceedings (proceedings of an event),
  • techreport (technical reports or working papers), and
  • unpublished (unpublished references).
  • online (biblatex的格式)
  • audio (biblatex的格式)

5 fields of references

5.1 address

address: It could be the city or country of a publisher, venue of a conference, address of an institution or school, or URL of a webpage. A URL may be inserted through the \url{ } command defined in the url package. (Datta 2017, 143)

address可以写网页链接。

5.2 author

author = {A B C D}中,

  • author会认为D为姓surname,作为印刷部分显示在中文,如果要C D作为姓,可以用{}框住,A B {C D}即可。
  • 如果是某个公司,比如A & B, Inc.中间的&需要加\,即A \& B, Inc.
  • et al.的显示方法是使用and others

5.3 pages

24--35 24,26,28 57+: 表示不太清楚(Datta 2017)

5.4 subtitle

title={{title: subtitle}}

@Manual{biblatexctan,
  title = {The biblatex Package},
  subtitle = {Programmable Bibliographies and Citations},
  author = {Philipp Lehman and Philip Kime and Moritz Wemheuer and Audrey Boruvka and Joseph Wright},
  year = {2018},
  url = {http://mirrors.cqu.edu.cn/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf}
}

因此这就是subtitle的效果。

6 常用例子

Verbosus (2017), Roberts and Wikibooks (2017) 给出比较常用的例子。

@article{article,
  author  = {Peter Adams}, 
  title   = {The title of the work},
  journal = {The name of the journal},
  year    = 1993,
  number  = 2,
  pages   = {201-213},
  month   = 7,
  note    = {An optional note}, 
  volume  = 4
}

@book{book,
  author    = {Peter Babington}, 
  title     = {The title of the work},
  publisher = {The name of the publisher},
  year      = 1993,
  volume    = 4,
  series    = 10,
  address   = {The address},
  edition   = 3,
  month     = 7,
  note      = {An optional note},
  isbn      = {3257227892}
}

@booklet{booklet,
  title        = {The title of the work},
  author       = {Peter Caxton}, 
  howpublished = {How it was published},
  address      = {The address of the publisher},
  month        = 7,
  year         = 1993,
  note         = {An optional note}
}

@conference{conference,
  author       = {Peter Draper}, 
  title        = {The title of the work},
  booktitle    = {The title of the book},
  year         = 1993,
  editor       = {The editor},
  volume       = 4,
  series       = 5,
  pages        = 213,
  address      = {The address of the publisher},
  month        = 7,
  organization = {The organization},
  publisher    = {The publisher},
  note         = {An optional note}  
}

@inbook{inbook,
  author       = {Peter Eston}, 
  title        = {The title of the work},
  chapter      = 8,
  pages        = {201-213},
  publisher    = {The name of the publisher},
  year         = 1993,
  volume       = 4,
  series       = 5,
  address      = {The address of the publisher},
  edition      = 3,
  month        = 7,
  note         = {An optional note}
}

@incollection{incollection,
  author       = {Peter Farindon}, 
  title        = {The title of the work},
  booktitle    = {The title of the book},
  publisher    = {The name of the publisher},
  year         = 1993,
  editor       = {The editor},
  volume       = 4,
  series       = 5,
  chapter      = 8,
  pages        = {201-213},
  address      = {The address of the publisher},
  edition      = 3,
  month        = 7,
  note         = {An optional note}
}

@manual{manual,
  title        = {The title of the work},
  author       = {Peter Gainsford}, 
  organization = {The organization},
  address      = {The address of the publisher},
  edition      = 3,
  month        = 7,
  year         = 1993,
  note         = {An optional note}
}

@mastersthesis{mastersthesis,
  author       = {Peter Harwood}, 
  title        = {The title of the work},
  school       = {The school of the thesis},
  year         = 1993,
  address      = {The address of the publisher},
  month        = 7,
  note         = {An optional note}
}

@misc{misc,
  author       = {Peter Isley}, 
  title        = {The title of the work},
  howpublished = {How it was published},
  month        = 7,
  year         = 1993,
  note         = {An optional note}
}

@phdthesis{phdthesis,
  author       = {Peter Joslin}, 
  title        = {The title of the work},
  school       = {The school of the thesis},
  year         = 1993,
  address      = {The address of the publisher},
  month        = 7,
  note         = {An optional note}
}

@proceedings{proceedings,
  title        = {The title of the work},
  year         = 1993,
  editor       = {Peter Kidwelly},
  volume       = 4,
  series       = 5,
  address      = {The address of the publisher},
  month        = 7,
  organization = {The organization},
  publisher    = {The name of the publisher},
  note         = {An optional note}
}

@techreport{techreport,
  author       = {Peter Lambert}, 
  title        = {The title of the work},
  institution  = {The institution that published},
  year         = 1993,
  number       = 2,
  address      = {The address of the publisher},
  month        = 7,
  note         = {An optional note}
}

@unpublished{unpublished,
  author       = {Peter Marcheford}, 
  title        = {The title of the work},
  note         = {An optional note},
  month        = 7,
  year         = 1993
}
@online{Back2016,
  author = {Back, Aaron},
  title = {Wells Fargo’s Questionable Cross-Selling Strategy},
  year = 2016,
  howpublished = {The Wall Street Jounral},
  url = {http://www.wsj.com/articles/wells-fargos-questionable-cross-selling-strategy-1473444334},
  urldate = {2018-06-17}
}

Navarro (2010) 提供了引用网页、博客的方案。

对公告的引用格式

Valencia College (2012) 给出了对公告的引用格式。

Simon Wiesenthal Center. (2007). *Palestine: Peace not apartheid-major fabrications and distortions.*
@bulletin{Caruana2014,
  author    = "Jaime Caruana",
  title     = "Global liquidity: where it stands, and why it matters",
  year      = "2014",
  month     = "3",
  day       = "5",
  publisher = "Bank for International Settlements",
  url       = "https://www.bis.org/speeches/sp140305.htm",
  address   = "Goethe University, Frankfurt, Germany"
}

注意,每一行的,容易漏掉,会导致R崩掉和老是报错。

@audio{Smith2018,
  author={Stacey Vanek Smith and Stanley Plotkin},
  title={The Economics of Vaccines},
  howpublished={NPR},
  organization={Planet Money}
  month=6,
  year=2010,
  series={Planet Money},
  url={https://www.npr.org/templates/transcript/transcript.php?storyId=616926505}
}
  • organization一般用在 @manual@online (Lehman et al. 2018, 22)
  • volumeseries一般用在系列数据,第几本 (Lehman et al. 2018, 37)

6.1 实际中用到比较多的

@online{魏剑峰当呼吸化为空气,
  author = {魏剑峰},
  title = {读一读《当呼吸化为空气》},
  year = 2018,
  howpublished: {英文悦读},
  url = {https://mp.weixin.qq.com/s/9x3HIWqv_3ELctpp-tfmAg},
  urldate = {2018-07-12}
}
@online{昂克英文松元音,
  author = {昂克英文},
  title = {昂克微课堂},
  subtitle = {04 /ʌ/ /ə/到底有什么区别?},
  year = 2018,
  url = {https://www.bilibili.com/video/av29831507/},
  urldate = {2018-08-21}
}

@online{Brandl2017,
  author = {Holger Brandl},
  title = {round_any equivalent for dplyr?},
  howpublished = {Stack Overflow},
  year = 2017,
  url = {https://stackoverflow.com/questions/43627679/round-any-equivalent-for-dplyr},
  urldate = {2018-08-15}
}

@online{ClouderaALTER,
  author = {{Cloudera, Inc.}},
  title = {ALTER TABLE Statement},
  year = 2018,
  url = {https://www.cloudera.com/documentation/enterprise/latest/topics/impala_alter_table.html#alter_table},
  urldate = {2018-06-03}
}

@video{Leitch2018,
author={David Leitch},
title={Deadpool 2},
publisher={Donners' Company and Kinberg Genre and Marvel Entertainment and Maximum Effort and TSG Entertainment (made in association with) and Twentieth Century Fox},
month=5,
year=2018,
note={At last},
url={https://www.imdb.com/title/tt5463162/}
}

7 ideas 查询 BibTex

例如 https://ideas.repec.org/p/cam/camdae/9710.html#author-abstract 查看#author-abstract

选择 Export reference as BibTex

附录

7.1 快速寻找参考文献

百度找老文献的时候,复制author (19XX),然后搜索别人写的全名的参考文献,再在百度学术里面寻找。

或者查看R的函数boxCoxVariable {car},可以在下方次、看到

References

  • Atkinson, A. C. (1985) Plots, Transformations, and Regression. Oxford.
  • Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. JRSS B 26 211–246.
  • Fox, J. (2008) Applied Regression Analysis and Generalized Linear Models, Second Edition. Sage.
  • Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage.

7.2 引用显示不出来

例如,[@Datta2017, pp. 40],显示不出来, 重启试试。 ## 小技巧

点击{} 边框处,可以全选里面所有信息。

7.3 csl文件

Xie (2017), RStudio (2018) 提示yaml 加入参数csl。 具体的参考文献格式变化可以使用不用的csl文档(Citation Style Language 2018)

---
title: "Sample Document"
output: html_document
bibliography: bibliography.bib
csl: biomed-central.csl
---
  • apa-5th-edition.csl: 日期前置,括号框起来
  • biomed-central.csl: 日期后置

7.5 在RMarkdown中引用

  1. 你这个属于技术文档@manual,因此页面需要你在引用的时候标注,比如你在正文使用, [@Pan2018,pp.199] 表示你引用@Pan2018这份文档的第199页。
  2. yihui的函数我忘记了,但是你可以查找下,是专门用来导出R包的bibtex的,技术文档,都是@manual
  3. 另外引用格式,我记得这个专门有一个yaml参数来限制的,你可以查询下csl文件相关的知识,一般来说apa6比较常用。我总结了一些,你可以看。 https://jiaxiangli.netlify.com/2018/03/bibtex/#csl

8 bib 文件直接生成参考文献

We make the bibliography appear using RefManageR::PrintBibliography and tools::bibstyle() in a chunk with the results="asis" option. We put that chunk exactly where we want the bibliography to appear. (Salmon 2020) We’ll start by creating a BibEntry object by calling RefManageR::ReadBib():

但是RefManageR::ReadBib()对 bibtex 进行严格限制。

参考文献

Citation Style Language. 2018. Citation Style Language. Citation Style Language.

Datta, Dilip. 2017. LaTeX in 24 Hours: A Practical Guide for Scientific Writing. 1st ed. Springer International Publishing.

Layton, Richard. 2015. “Happy Collaboration with Rmd to Docx.” 2015. https://rmarkdown.rstudio.com/articles_docx.html.

Lehman, Philipp, Philip Kime, Moritz Wemheuer, Audrey Boruvka, and Joseph Wright. 2018. The Biblatex Package: Programmable Bibliographies and Citations. http://mirrors.cqu.edu.cn/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf.

Navarro, Juan A. 2010. “How Can I Use Bibtex to Cite a Web Page?” 2010. https://tex.stackexchange.com/questions/3587/how-can-i-use-bibtex-to-cite-a-web-page.

Roberts, Andy, and Wikibooks. 2017. “LaTeX/Bibliography Management.” 2017. https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management.

RStudio. 2018. Bibliographies and Citations. RStudio.

Salmon, Maëlle. 2020. “A Roundup of R Tools for Handling Bibtex.” rOpenSci. 2020. https://ropensci.org/technotes/2020/05/07/rmd-citations/.

Valencia College. 2012. “APA Citation: Pamphlet, Brochure, or Bulletin.” 2012. https://valenciacollege.edu/library/mla-apa-chicago-guides/documents/PamphletBrochureBulletinAPA6.pdf.

Verbosus. 2017. “How Can I Use Bibtex to Cite a Web Page?” 2017. https://www.verbosus.com/bibtex-style-examples.html.

Xie, Yihui. 2017. “Rmarkdown Does Not Have Bibliography Style Effect.” 2017. https://stackoverflow.com/questions/46973653/rmarkdown-does-not-have-bibliography-style-effect.


  1. +, -, :都是可以可以的,例如Even-etal-1976Even+:1976