Skip to content

MDPI issue with unicode characters #325

@etiennebr

Description

@etiennebr

Using rticles::mdpi_article by @dleutnant (thank you sir), I have an issue with Unicode characters contained in the text (and probably the bibliography as well). I can reproduce the bug on the default mdpi_article Rmd by throwing e.g. Δ somewhere in the text.

! Package inputenc Error: Unicode character Δ (U+0394)
(inputenc)                not set up for use with LaTeX.

xelatex seemed like the solution but mdpi_article doesn't seem to support it. Using:

output: 
  rticles::mdpi_article: 
    latex_engine: xelatex

on the default mdpi_article template gives

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

So I used a preamble to insert definitions

\DeclareUnicodeCharacter{2009}{\,}
\DeclareUnicodeCharacter{2300}{$\oslash$}
% ... more unicode characters!

With

output: 
  rticles::mdpi_article: 
    includes:
      latex_engine: pdflatex
      in_header: "preamble.tex"

But the list of unicode characters I need to define is increasingly long an it seems like I'll have to define the whole UTF-8 set!

Is there a way to make the mdpi package use xelatex, or support utf8 and resolve the issue once for all, or I should just spend that time declaring utf characters in the preamble?

For context, I'm converting papers originally written in Word and Google docs. I would probably have used the math notation if I was writing the Rmd directly, although I like having the symbols in the RMD (in Rstudio at least), it reads nicely.


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rticles'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rticles').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions