Search code examples
rlatexr-markdownbibliographycitations

Missing "&" and commas in in-text citations in Rmarkdown


My pdf output does not show APA in-text citation properly.

This is my YAML

---
title: "A fancy project"
author: "A reliable human being"
output:
  pdf_document:
    latex_engine: lualatex  
    citation_package: biblatex         
    keep_tex: yes
header-includes:
  - \usepackage{arabluatex}
  - \usepackage{fontspec}
  - \newfontfamily\arabicfont[Script=Arabic]{Lateef}
date: "2022-09-16"
bibliography: references.bib
csl: apa.csl
biblatexoptions:
  - citestyle = authoryear
  - bibstyle = authoryear
---

``{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
``

# Rmarkdown

Lorem ipsum dolor sit amet [@al2020الخصائص] consectetur.


# Reference

reference.bib

@article{al2020الخصائص,
  title={\txarb{الخصائص السيكو مترية للصورة العربية للإصدار الثاني من قائمة الخمسة الكبار}},
  author={Al-Ansari, Bader M and Alali, Talal B},
  journal={BAU Journal-Society, Culture and Human Behavior},
  volume={1},
  number={2},
  pages={3},
  year={2020}
}

enter image description here

Note that the "&" character is not used and commas are missing. Instead of

(Al-Ansari and Alali 2020)

it should be

(Al-Ansari & Alali, 2020)

The problem persists in the references as well where "&" should be used.


Solution

  • Set biblatex style option as apa, and you do not have to specify csl: apa.

    ---
    title: "A fancy project"
    author: "A reliable human being"
    output:
      pdf_document:
        latex_engine: lualatex  
        citation_package: biblatex         
        keep_tex: yes
    header-includes:
      - \usepackage{arabluatex}
      - \usepackage{fontspec}
      - \newfontfamily\arabicfont[Script=Arabic]{Lateef}
    date: "2022-09-16"
    bibliography: references.bib
    biblatexoptions:
      - style = apa
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE)
    ```
    
    # Rmarkdown
    
    Lorem ipsum dolor sit amet [@al2020الخصائص] consectetur.
    
    
    # Reference
    
    

    Apa style in Arabic references with biblatex