r markdown R ! LaTeX Error: Unicode character ​ (U+200B) not set up for use with LaTeX.

Hi all

I'm trying to loop through r markdown to create about 100 reports out of a data table. but every time I do I'm getting errors on a : Unicode character ​ (U+200B) not set up for use with LaTeX. as there is over 100 reports I can't change each report individually of find the particular string.

I've tried changing the rendering engines but did not work as per (https://bookdown.org/yihui/rmarkdown-cookbook/latex-unicode.html)

I've looked at The R package tinytex - Helper Functions to Manage TinyTeX, and Compile LaTeX Documents - Yihui Xie | 谢益辉 but I'm still at a loss.

platform x86_64-w64-mingw32
arch x86_64
os mingw32
version.string R version 4.3.2 (2023-10-31 ucrt)

tlmgr revision 68903 (2023-11-19 19:53:19 +0100)
tlmgr using installation: C:/Users/price/AppData/Roaming/TinyTeX
TeX Live (TeX Live - TeX Users Group) version 2023

pdfTeX, Version 3.141592653-2.6-1.40.24
(TeX Live 2022) (preloaded format=pdflatex)

  1. has anyone experienced this before?
  2. is there anyway I could clean the table with a regex to get rid of the Unicode that is causing the issue, i.e.. do a regex on the entire table and just make the table only contain pure text and numbers.
  3. Any other ideas on figuring this out?

For loop

\```{r setup loop though people, include=FALSE, , message = FALSE}

for (i in unique(WAM_2022_2023$\Contact Details)) {


input = "Base_report-WAM-PDF-CSV-v4.Rmd", # 1. Search for your base report

output_format = "pdf_document", # 2. Establish the format

output_file = paste0(i ,"_WAM_report.pdf"), # 3. Define the output file name

output_dir = "test", # 4. Define an output folder/directory

params = list(ContactDetails = i)) # 5. Integrate your parameters


Setup of rMarkdown for each individual file

title: "Multiple Reports R-Markdown"
pdf_document: default
latex_engine: xelatex
keep_tex: true
classoption: landscape

ContactDetails: 0

\```{r setup1, include=FALSE}

knitr::opts_chunk$set(echo = TRUE)


Error from R Studio

Quitting from lines 43-53 [setup loop though people] (LoopTest-WAM-Pdf-CSV-v4.Rmd)


! LaTeX failed to compile C:/Users/XXXXX/OneDrive - XXXXXX/Documents/R/WamPdf2022To2023/test/XXXXXX Zhu_WAM_report.tex.

See https://yihui.org/tinytex/r/#debugging for debugging tips. See xxxxxxxZhu_WAM_report.log for more info.

1. rmarkdown::render(...)
2. rmarkdown:::latexmk(...)
3. tinytex::latexmk(file, engine, if (biblatex) "biber" else "bibtex")
4. tinytex:::latexmk_emu(...)
5. tinytex (local) run_engine()
7. tinytex (local) on_error()
8. tinytex:::show_latex_error(file, logfile)
Execution halted

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode

Error from Log file

! LaTeX Error: Unicode character ​ (U+200B)

not set up for use with LaTeX.

See the LaTeX manual or LaTeX Companion for explanation.

Type H for immediate help.


l.204 Director (Programme) & 120 & NA & BCL (L​

aw & Irish)​ & BCLGA & D...

See the second answer here

Please can you format your issue correctly ?

thank you

FAQ: How to Format R Markdown Source

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.