1

I always use the bable (french) package and it works fine when one Overleaf or MiKTex. However, when copy pasting my code to Rstudio (with Sweave etc), it just does not work properly.

Document with "é" when done with Sweave

Same document (code copy pasted) on MiKTex

I have following packages:

\documentclass[a4paper, parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{array}
\usepackage{tensor}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[abbrev,backrefs]{amsrefs}
\usepackage{appendix}

Since I don't know much about Rstudio, I don't know what information you need about it. I will provide more info when asked for. I followed a simple tutorial on youtube to get sweave working.

Thank you.

Edit:

Here is a minimal document. (not sure how to link the whole pdf)

The code in Rstudio (Sweave) is following:

\documentclass[a4paper, parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{array}
\usepackage{tensor}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[abbrev,backrefs]{amsrefs}
\usepackage{appendix}

\title{Année académique}
\date{}

\begin{document}
\SweaveOpts{concordance=TRUE}
\maketitle

This is a sentence with the characters é and è.

\end{document}
Maga
  • 11
  • 2
  • Can you post a minimal document with your sentences? – James Curran Apr 13 '20 at 02:12
  • I edited my post. Hope it is what you asked for. – Maga Apr 13 '20 at 12:06
  • It is thanks. I used the `knitr` engine rather than Sweave (Tools > Global Options... > Sweave and then change "Weave Rnw files using:" to "knitr"), deleted the `\SweaveOpts` line, and it rendered your acute e's perfectly. I do need to write French names or words occasionally when I write, and I just use the \'{e} method of accenting the letters - but I think that would be a real pain for you. I am curious if changing to `knitr` helps – James Curran Apr 13 '20 at 21:38
  • 1
    Thanks, you actually fixed something else I was looking into (displayint the code with the right colors). However just changing that did not fix it. I found another post here (https://stackoverflow.com/questions/25722430/using-special-characters-in-rstudio) and the last answer fixed my problem. Seems like Rstudio wasn't in UTF-8. Again, thank you for your help. – Maga Apr 13 '20 at 22:33

0 Answers0