`fmtutil` errors for figure chunks in bookdown document


When compiling my bookdown document to PDF via latex,
I get nice output, but the following errors for my figure chunks:

! Missing number, treated as zero.
<to be read again> 
<to be read again> 
\addlanguage ...\chardef \csname rhm@#1\endcsname 
                                                  =#5 \uselanguage {#1}\inpu...
l.65 \addlanguage{arabic}{zerohyph.tex}{}{}{}
! Emergency stop.

This error message is totally correct and stems from running fmtutil-sys --all.

So what does it have to do with RStudio, which does a good job and is not the source of the error at all?

After carefully reading the output of fmtutil-sys and doing some web search, one quickly realizes that it is only trying to generate hyphenation patterns, which I actually don’t need as is also obvious from the perfect PDF output.

My question now is, why RStudio triggers the fmtutil-sys at all for the figure code chunks and whether it can somehow be prevented.

This would be helpful, because the fmtutil-sys runs seem to prolong the compilation time of the file quite a bit.


More than 1 1/2 months later, I could pin down the problem, which is a reported bug deep inside the guts of TeX:
If the parameter #4 and #5 of the respective macro are empty, it crashes.

Therefore, 2 possible solutions have been proposed:

This problem seems to be specific for older versions of Red Hat/Cent OS/Fedora.
On newer versions of Linux, everything should work fine.