Latex code in Rmd

Hi,

My issue is that I wrote the following chunk in a rmd knitting to PDF:

A <- matrix(c(1, 2, 1, -1), nrow = 2)
b <- c(1,1)
matlib::showEqn(A, b, latex = T)

But the output in the tex file is:

\begin{verbatim}
\begin{array}{lllll}
1 \cdot x_1 &+& 1 \cdot x_2 &=& 1 \
2 \cdot x_1 &-& 1 \cdot x_2 &=& 1 \
\end{array}
\end{verbatim}

Hence in the PDF I got the latex code printed instead of the function I need.
image
I know that the problem is with the verbatim row, but how can you avoid this issue?

Thank you for your help in advance,

Marcell

You need to add results='asis' to your code chunk declaration. E.g.:

```{r results='asis'}
matlib::showEqn(A, b, latex = T)
```
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.