isubirana / compareGroups

R package to easily build publication-ready univariate or bivariate descriptive tables from a data set.
https://isubirana.github.io/compareGroups/
33 stars 14 forks source link

report - not encoding in UTF-8 #9

Closed xmarti6 closed 4 years ago

xmarti6 commented 4 years ago

Hi, when I was testing the full report() function I realized that character encoding in the .tex file is not utf-8, but ansi. Thus, when using characters with accents, for instance, they are not correctly interpreted showing odd characters. Overriding the "report()" function with the following solves the issue, and PDF and .tex file show characters correctly:

file.tex <- sub("pdf$","tex",file) con<-file(file.tex,encoding="UTF-8") #added write(text,file=con) #added

write(text,file=file.tex) #skip

Greetings

xmarti6 commented 4 years ago

I could also find a couple of improvements more in order to use special characters in caption and filenames that might be helpful for someone: