I tried to run Sweave on a .Rnw file from TeXstudio, but the unicode characters don't show up in the .tex file when I typeset with xelatex.

My user command is /usr/local/bin/Rscript -e "Sweave('%.Rnw', encoding = 'utf8')".

The MWE document is the following.



1 + 2

ɑʃɱɪ àüõ


TeXstudio seems not to call the locale as expected, so it is necessary to set the locale within the user command in TeXstudio:

/usr/local/bin/Rscript -e "Sys.setlocale('LC_ALL', 'en_US.UTF-8'); Sweave('%.Rnw', encoding = 'utf8')"

The Rscript path should be changed according to your OS.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.