I have one reference in Arabic that shows blank squares instead of the Arabic characters.
This is my YAML
---
title: "A fancy project"
author: "A reliable human being"
output:
bookdown::pdf_document2:
latex_engine: lualatex
keep_tex: yes #keep the latex format
header-includes:
- \usepackage[arabic, english]{babel}
- \usepackage{fontspec}
- \setmainfont{Garamond}
date: "2022-09-16"
bibliography: references.bib
csl: apa.csl
---
My reference is this one:
@article{al2020الخصائص,
title={الخصائص السيكو مترية للصورة العربية للإصدار الثاني من قائمة الخمسة الكبار},
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}
}
This is my session info:
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22622)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] kableExtra_1.3.4 dplyr_1.0.10
loaded via a namespace (and not attached):
[1] pillar_1.8.1 compiler_4.2.1 tools_4.2.1 digest_0.6.29
[5] viridisLite_0.4.1 evaluate_0.16 lifecycle_1.0.2 tibble_3.1.8
[9] pkgconfig_2.0.3 rlang_1.0.6 cli_3.4.1 DBI_1.1.3
[13] rstudioapi_0.14 yaml_2.3.5 xfun_0.33 fastmap_1.1.0
[17] stringr_1.4.1 httr_1.4.4 knitr_1.40 xml2_1.3.3
[21] systemfonts_1.0.4 generics_0.1.3 vctrs_0.4.1 webshot_0.5.3
[25] tidyselect_1.1.2 svglite_2.1.0 glue_1.6.2 R6_2.5.1
[29] fansi_1.0.3 rmarkdown_2.16 bookdown_0.29 purrr_0.3.4
[33] magrittr_2.0.3 scales_1.2.1 htmltools_0.5.3 assertthat_0.2.1
[37] rvest_1.0.3 colorspace_2.0-3 utf8_1.2.2 stringi_1.7.8
[41] munsell_0.5.0
I have tried the solutions proposed here and here, but to no avail. They apply if Arabic characters are wanted within the text, so solutions like marking the text that you want in Arabic are not an option.
I think you have everything you need to reproduce it yourself.
One way you could show arab-text in bibliography by wrapping that arab text with \txarb
from the arabluatex
package and using biblatex
as citation pacakge.
---
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
references.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}
}