jck21
jck21

Reputation: 811

With natbib citation package, how to make THREE authors appear on the citation in rmarkdown latex document

Instead of Jones et al., I want to make each author's name show up in my text citation until three with citation package natbib(from 4 authors it should be Jones et al.). I tried citet*{} and citet{}, but they didn't work. My rmarkdown code and .bib file are given as follows:

---
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" 
}

Upvotes: 1

Views: 2692

Answers (1)

Use biblatex.

If your bibtex style does not happen to be exactly what you want, biblatex is much more flexible and easier to modify.

---
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

And the bib file without illegal characters like â :

@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" 
}

enter image description here

Upvotes: 0

Related Questions