Jannic Beck
Jannic Beck

Reputation: 2425

R: Knitr Syntax expression as text

I'm using the knitr package with RStudio and want to write the following expression as text in my output pdf file:

\Sexpr{pi}

I tried the LaTeX math mode:

$\Sexpr{pi}$

but it will give me the value and not the text.

Upvotes: 2

Views: 168

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30114

Write \textbackslash{}Sexpr\{pi\}.

Upvotes: 4

Related Questions