メモ:rmarkdown
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン次のリビジョン両方とも次のリビジョン | ||
メモ:rmarkdown [2020/05/11 10:39] – [PDF出力用の基本設定] admin | メモ:rmarkdown [2020/05/12 10:56] – [Loopでチャンク作成] admin | ||
---|---|---|---|
行 30: | 行 30: | ||
- \setpagelayout * {margin=20mm} | - \setpagelayout * {margin=20mm} | ||
- \renewcommand{\baselinestretch}{0.9} | - \renewcommand{\baselinestretch}{0.9} | ||
+ | - | ||
- \usepackage[compact]{titlesec} | - \usepackage[compact]{titlesec} | ||
- | - \titlespacing*{\section}{0pt}{*0}{0pt} | + | - \titlespacing{\section}{0pt}{5pt}{3pt} |
- | - \titlespacing*{\subsection}{0pt}{*0}{0pt} | + | - \titlespacing{\subsection}{0pt}{5pt}{3pt} |
+ | - | ||
- \renewcommand{\labelitemi}{■} | - \renewcommand{\labelitemi}{■} | ||
- \renewcommand{\labelitemii}{$\circ$} | - \renewcommand{\labelitemii}{$\circ$} | ||
行 103: | 行 105: | ||
| | ||
``` | ``` | ||
+ | |||
+ | |||
+ | ===== パラグラフ間の余白(パラグラフ送り) ===== | ||
+ | |||
+ | パラグラフ間の字送り(余白)の設定。標準では1行空きになっているようだ。全体の設定を変更するにはヘッダ部分に以下を記述。 | ||
+ | |||
+ | | ||
+ | - \setlength{\parskip}{1.5em} | ||
+ | |||
+ | |||
===== Loopでチャンク作成 ===== | ===== Loopでチャンク作成 ===== | ||
図表を連続して作成する場合など、チャンク内のLoopから別のチャンクを生成したい場合がある。 | 図表を連続して作成する場合など、チャンク内のLoopから別のチャンクを生成したい場合がある。 | ||
- | まずテンプレートとなるチャンクを作成する。ループで回すように、必要な個所は変数化し該当箇所を「{{変数名}}」にしておく。以下の例では、チャンク名とキャプション、ggplotのy軸に使う変数名を外部から与えるパラメータにした。 | + | まずテンプレートとなるチャンクを作成する。ループで回すように、必要な個所は変数化し該当箇所を「%%{{%%変数名%%}}%%」にしておく。以下の例では、チャンク名とキャプション、ggplotのy軸に使う変数名を外部から与えるパラメータにした。 |
```{r チャンク名_{{prm_chankname}}, | ```{r チャンク名_{{prm_chankname}}, | ||
ggplot(data=DAT, | ggplot(data=DAT, | ||
geom_line() ... | geom_line() ... | ||
+ | | ||
``` | ``` | ||
メモ/rmarkdown.txt · 最終更新: 2023/06/22 11:00 by Wiki Editor