【问题标题】:With natbib citation package, how to make THREE authors appear on the citation in rmarkdown latex document使用 natbib 引用包,如何让三位作者出现在 rmarkdown 乳胶文档的引用中
【发布时间】:2021-12-27 03:10:02
【问题描述】:

而不是 Jones et al.,我想让每个作者的名字出现在我的文本引用中,直到 三个 引用包 natbib(来自 4 个作者应该是 琼斯等人。)。 我试过citet*{}citet{},但它们没有用。 我的rmarkdown代码和.bib文件如下:

---
title: "Paper"   
thanks: 
author: |
  | \normalfont Joe
output: 
  pdf_document:
    number_sections: true
    citation_package: natbib
    fig_caption: true
    fig_height: 4.5
    fig_width: 8
link-citations: yes
toc: false
bibliography: /Users/references02.bib
biblio-style: apalike    
in_header: preamble.tex
keep_tex: yes
fontsize: 11pt
linestretch: 1.3
subparagraph: true
number_sections: true
geometry: margin=1in
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \usepackage{filecontents}
- \newtheorem{prop}{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithem}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage[toc,page]{appendix}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
  {\left.\begin{aligned}}
  {\end{aligned}\right\rbrace}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
     colorlinks=true,
     linkcolor=black,
     filecolor=blue,
     citecolor = blue,      
     urlcolor=blue,
     }
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes} 
- \usepackage[nameinlink,capitalize,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}
- \usepackage{dcolumn}
- \usepackage{rotating}
- \usepackage{siunitx}
---


blah blah  \cite{ennis2019} \cite{worldbank2017}


@article{ennis2019,
    author = {Ennis, Sean F and Gonzaga, Pedro and Pike, Chris},
    title = "{Inequality: A hidden cost of market power}",
    journal = {Oxford Review of Economic Policy},
    volume = {35},
    number = {3},
    pages = {518-549},
    year = {2019},
    month = {07},
    abstract = "{This paper explores the impact of competition on inequality by developing a new model to illustrate how higher profits from market power, and associated higher prices, could influence the distribution of wealth and income. We analyse data from eight OECD countriesâCanada, France, Germany, Korea, Japan, Spain, the United Kingdom, and the United States. In an average country in the sample, market power increases the wealth of the richest 10 per cent by between 12 and 21 per cent for a range of reasonable assumptions about savings behaviour, while it reduces the income of the poorest 20 per cent by 11 per cent or more. The results contribute to the economic literature on the origins of inequality, suggesting that lack of competition may be one source of economic inequality.}",
    issn = {0266-903X},
    doi = {10.1093/oxrep/grz017},
    url = {https://doi.org/10.1093/oxrep/grz017},
    eprint = {https://academic.oup.com/oxrep/article-pdf/35/3/518/28929084/grz017.pdf},
}

@book{worldbank2017,
   author = "World Bank",
   title = "A Step Ahead: Competition Policy for Shared Prosperity and Inclusive Growth",
   year = "2017",
   pages = 245,
   url = "https://www.oecd-ilibrary.org/content/publication/978-1-4648-0945-3",
   doi = "https://doi.org/https://doi.org/10.1596/978-1-4648-0945-3" 
}

【问题讨论】:

  • 改用 biblatex -- 如果您的 bibtex 风格与您想要的不完全一致,biblatex 会更加灵活且更容易修改。
  • @samcarter_is_at_topanswers.xyz,有没有什么办法可以用我当前的 yaml 头文件和 .bib 文件轻松转移到 biblatex ?我曾经尝试过,但变得非常混乱而且有些复杂,所以我就放弃了。无论如何我会再试一次,谢谢。
  • 当然,我发布了一个示例作为答案

标签: latex r-markdown


【解决方案1】:

使用biblatex

如果您的bibtex 样式恰好不是您想要的,biblatex 会更灵活且更易于修改。

---
title: "Paper"   
thanks: 
author: |
  | \normalfont Joe
output: 
  pdf_document:
    keep_tex: true
    number_sections: true
    fig_caption: true
    fig_height: 4.5
    fig_width: 8
toc: false
in_header: preamble.tex
keep_tex: yes
fontsize: 11pt
linestretch: 1.3
subparagraph: true
number_sections: true
geometry: margin=1in
header-includes:
- \usepackage{amsmath}
- \usepackage{amsthm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage[english]{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \usepackage{filecontents}
- \newtheorem{prop}{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithem}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage[toc,page]{appendix}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
  {\left.\begin{aligned}}
  {\end{aligned}\right\rbrace}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
     colorlinks=true,
     linkcolor=black,
     filecolor=blue,
     citecolor = blue,      
     urlcolor=blue,
     }
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes} 
- \usepackage[nameinlink,capitalize,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}
- \usepackage{dcolumn}
- \usepackage{rotating}
- \usepackage{siunitx}
- \usepackage[natbib, style=authoryear]{biblatex}
- \addbibresource{bib.bib}
---


blah blah  \cite{ennis2019} \cite{worldbank2017}

\printbibliography

还有没有â等非法字符的围兜文件:

@article{ennis2019,
    author = {Ennis, Sean F and Gonzaga, Pedro and Pike, Chris},
    title = "{Inequality: A hidden cost of market power}",
    journal = {Oxford Review of Economic Policy},
    volume = {35},
    number = {3},
    pages = {518-549},
    year = {2019},
    month = {07},
    abstract = "{This paper explores the impact of competition on inequality by developing a new model to illustrate how higher profits from market power, and associated higher prices, could influence the distribution of wealth and income. We analyse data from eight OECD countries Canada, France, Germany, Korea, Japan, Spain, the United Kingdom, and the United States. In an average country in the sample, market power increases the wealth of the richest 10 per cent by between 12 and 21 per cent for a range of reasonable assumptions about savings behaviour, while it reduces the income of the poorest 20 per cent by 11 per cent or more. The results contribute to the economic literature on the origins of inequality, suggesting that lack of competition may be one source of economic inequality.}",
    issn = {0266-903X},
    doi = {10.1093/oxrep/grz017},
    url = {https://doi.org/10.1093/oxrep/grz017},
    eprint = {https://academic.oup.com/oxrep/article-pdf/35/3/518/28929084/grz017.pdf},
}

@book{worldbank2017,
   author = "World Bank",
   title = "A Step Ahead: Competition Policy for Shared Prosperity and Inclusive Growth",
   year = "2017",
   pages = 245,
   url = "https://www.oecd-ilibrary.org/content/publication/978-1-4648-0945-3",
   doi = "https://doi.org/https://doi.org/10.1596/978-1-4648-0945-3" 
}

【讨论】:

  • 快速提问:我的参考资料没有显示,在这种情况下,我应该在此处添加 .bib 文件之前的所有路径,例如:- \addbibresource{/Users/references02.bib}
  • @joe 是的,这看起来是正确的(不要忘记清理你的 bib 文件以删除非法字符,例如 â
  • 当然看起来仍然没有显示参考。让我配置我的 TexShop 并再试一次。谢谢。
  • 您可以尝试使用我帖子中完全相同的示例和围兜文件吗?这样你应该看看配置是否正确。
  • 当然让我这样做,正如您所指出的,我的 bib 文件中有很多像 drés RodrÃguez-C 这样的字符,如果我仍然遇到问题,我会告诉您。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-10-14
  • 1970-01-01
相关资源
最近更新 更多