4

I tried it using the commented out code without success. Can somebody help?

\documentclass[a4paper]{article}
%\usepackage[english,greek]{babel}


%\latintext 
\title{Sweave Example 1}
\author{George Dontas}

\begin{document}

\maketitle

In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document:

%\greektext 
Αυτό είναι κείμενο στα Ελληνικά
%\latintext
<<eval=TRUE,echo=TRUE,warning=FALSE,message=FALSE,error=FALSE>>=
data(airquality)

kruskal.test(Ozone ~ Month, data = airquality)
@

which shows that the location parameter of the Ozone distribution varies significantly from month to month. Finally we
include a boxplot of the data:

\begin{center}
<<eval=TRUE,echo=FALSE,results='hide',warning=FALSE,message=FALSE,error=FALSE>>=
boxplot(Ozone ~ Month, data = airquality)
@
\end{center}

\end{document}
gd047
  • 29,749
  • 18
  • 107
  • 146
  • It might be useful if you add the error message you get into your post. – Jouni Helske Feb 28 '13 at 15:30
  • 1
    if the Sweave process works fine and the failure occurs in the processing from (La)TeX to PDF, this question would probably be more appropriate at http://tex.stackexchange.com – Ben Bolker Feb 28 '13 at 15:42

1 Answers1

2

The problem here is not the R but matter of getting latex to play well with Greek. With hat tip to this answer, perhaps the easiest solution is to switch to XeLaTeX compilation and rewrite your file as

\documentclass[a4paper]{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\setsansfont{Arial}
\newfontfamily\greekfont[Script=Greek]{Linux Libertine O}
\newfontfamily\greekfontsf[Script=Greek]{Linux Libertine O}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{greek}

\title{Sweave Example 1}
\author{George Dontas}

\begin{document}
\maketitle

Ελληνικό κείμενο

In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document:

... 

and so on as before. Then compile with XeLaTeX (latexmk -xelatex file.Rnw will do that).

Community
  • 1
  • 1
conjugateprior
  • 398
  • 1
  • 15