使用希腊语文本编译.Rnw到pdf

时间:2013-02-28 15:05:34

标签: windows r pdf sweave miktex

我使用已注释的代码尝试了它但没有成功。有人可以帮忙吗?

\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}

1 个答案:

答案 0 :(得分:2)

这里的问题不是R,而是让乳胶与希腊语发挥良好关系。使用帽子提示到this answer,也许最简单的解决方案是切换到XeLaTeX编译并将文件重写为

\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:

... 
和以前一样

等。然后使用XeLaTeX进行编译(latexmk -xelatex file.Rnw将执行此操作)。