gpt4 book ai didi

windows - 将带有希腊文本的 .Rnw 编译为 pdf

转载 作者:可可西里 更新时间:2023-11-01 14:18:55 26 4
gpt4 key购买 nike

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

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

最佳答案

这里的问题不是 R,而是让 latex 与 Greek 兼容的问题。帽子提示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 会这样做)。

关于windows - 将带有希腊文本的 .Rnw 编译为 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15138826/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com