0

Knitr を使用して .Rnw ファイルを .tex ファイルに変換するときに、学名をイタリック体にしようとしています。実行中にエラーが発生しますknit。これは私の.Rnwファイルに含まれる私のコードです(実行する必要taxizestringrライブラリがあります):

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum \Sexpr{str_c("Collared Flycatchers (\\textit{", comm2sci(commnames='Collared Flycatcher', db="itis")[[1]], "})")[1]}

.tex ファイルの出力は次のようになります。

Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Collared Flycatchers (\textit{Ficedula semitorquata})

この出力を .tex ファイルで取得するにはどうすればよいですか?

4

1 に答える 1

3

これは私のために働く

\documentclass{article}
\begin{document}
<<message=FALSE>>=
library("taxize")
@
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum \textit{\Sexpr{comm2sci(commnames='Collared Flycatcher', db="itis")[[1]][2]}}
\end{document}

これはあなたが望むものをあなたに与えますか?私にとっては出力pdfに正しく見えます。

于 2014-05-04T19:08:23.433 に答える