Render latex text from within r function in rmarkdown?

Viewed 1661

I am working within RStudio 1.1.383 using rmarkdown. I am trying to render to Latex a string that is created within a knitr chunk so that it appears as latex code within the document.

So far I have experimented with the 'results=' options in the chunk header and find that results='asis' enables it to be rendered once the document is knitted, but I have not been able to find a way to enable the result to be rendered using the preview feature that allows you to run a single chunk and see the results within the .Rmd editor.

Any help on this matter would be appreciated.

A minimal example is included below that should be copied into a .Rmd file before rendering.

Thanks in advance,

Michael

---
title: "Minimal Example"
output: html_document
---

```{r}
str <- "$$\\alpha \\cdot \\beta = \\delta$$"

# this doesn't show in the preview 'run chunk feature'
cat(str, "\n")

# neither does this
writeLines(str)
```
0 Answers
Related