Rstudio を使用して、knitr と pandoc を介して Windows で MiKTeX を使用して PDF に変換する RMarkdown ドキュメントを作成しています。LaTeX エンジンは xelatex です。
私の .Rmd ファイルの YAML ヘッダー:
---
title: "My Title"
author: "Me"
geometry: margin=2cm
output:
pdf_document:
fig_caption: no
fig_height: 4
fig_width: 6
latex_engine: xelatex
html_document:
css: styles.css
keep_md: no
fontsize: 10pt
---
私が持っているテキストでは
...parameter $\lambda=0.2$ with...
そして、「parameter = 0 2 with」を取得します-ラムダとドットの両方が欠落しています。
この行
mean of $\frac{1}{\lambda}=5$ of the
になる
編集:実験として追加しようとすると(私はWindowsを使用しています)
mainfont: Arial
YAML ヘッダーに pandoc エラーが発生します
! Undefined control sequence.
\fontspec_calc_scale:n ...ec_tmpb_dim }\fp_div:Nn
\l_fontspec_tmpa_fp {\l_fo...
l.18 \setmainfont{Arial}
pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
アップデート:
実行pdflatex report1.pdf
すると、正しい PDF が生成されます。
RStudio が実行されます"C:/Program Files/RStudio/bin/pandoc/pandoc" report1.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output report1.pdf --template "D:\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine xelatex
そのため、「pdflatex」は機能しますが、他の推奨エンジン「xelatex」は誤った出力を生成するようです。残念ながら、いくつかの情報源を含む理由を忘れてしまいました。数日前にxelatexに切り替えたときに従ったので、pdflatexではなくRStudioのknitrで使用することを強くお勧めしたことを覚えています。