MDPI does not compile with the xelatex and lualatex engines (Undefined control sequence) (original) (raw)

The MDPI option does not compile with the xelatex and lualatex engines. This makes it difficult to use Chinese characters or other UTF8 characters since those are not supported by pdflatex.

Example:

---
title: "Title"
output:
 rticles::mdpi_article:
  latex_engine: xelatex
---

Hello world!

Creates the error:

! Undefined control sequence.
\set@color ->\pdfcolorstack 
                            \@pdfcolorstack push{\current@color }\aftergroup...
l.1462 \color{black}

Error: LaTeX failed to compile [filename].tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See paper_v6.log for more info.
Execution halted

xfun::session_info():

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000), RStudio 2022.7.1.554

Locale:
  LC_COLLATE=Chinese (Traditional)_Hong Kong SAR.utf8  LC_CTYPE=Chinese (Traditional)_Hong Kong SAR.utf8    LC_MONETARY=Chinese (Traditional)_Hong Kong SAR.utf8 LC_NUMERIC=C                                        
  LC_TIME=Chinese (Traditional)_Hong Kong SAR.utf8    

Package version:
  base64enc_0.1.3  bslib_0.4.0      cachem_1.0.6     digest_0.6.29    evaluate_0.15    fastmap_1.1.0    fs_1.5.2         glue_1.6.2       graphics_4.2.0   grDevices_4.2.0  highr_0.9        htmltools_0.5.3  jquerylib_0.1.4 
  jsonlite_1.8.0   knitr_1.39.6     magrittr_2.0.3   memoise_2.0.1    methods_4.2.0    R6_2.5.1         rappdirs_0.3.3   rlang_1.0.4      rmarkdown_2.14.3 sass_0.4.2       stats_4.2.0      stringi_1.7.8    stringr_1.4.0   
  tinytex_0.40     tools_4.2.0      utils_4.2.0      xfun_0.31        yaml_2.3.5      

Pandoc version: 2.18

paper_v6.log


By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.