LoginSignup
4
4

More than 5 years have passed since last update.

RStudio+XeLaTeX on Windows

Last updated at Posted at 2014-01-23

XeLaTeXで日本語を表示させるということをWindowsのRStudioでやってみる。
そのまんまだと、\sectionやチャンク内で日本語が表示されない。

\documentclass{article}
##ここに日本語フォントを指定
\usepackage{xeCJK}
\setCJKmainfont{MS Mincho}
\setCJKsansfont{MS Gothic}
\setCJKmonofont{MS Gothic}
\XeTeXlinebreaklocale "ja"


\title{Sweave使いたい}
\author{名前}

\begin{document}

\SweaveOpts{concordance=TRUE}

\maketitle
\newpage

\section{Rで解析}
次のChunkはコンパイルに問題ない。
<<lib>>=
# パッケージの読み込み
library(car) # scatterplot
library(MASS) # stepAIC
@

\section{なぜに?}
<<reading>>=
# あやめデータ
head(iris)
@

チャンク内と同様にverbatim環境でも日本語が表示される
 \begin{verbatim} 
 Japanese 日本語
 \end{verbatim}

\end{document}
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4