I have a character vector containing ampersand (&
) that displays correctly when used outside LaTeX environment, such as \begin{itemize}
.
This works:
---
output:
pdf_document
---
`r "Guns & Roses"`
The above code runs without error, meaning that either knitr
or rmarkdown
escapes the ampersand automatically.
Now, when the same R character vector with ampersand is specified inside LaTeX environment, following error is thrown: ! Misplaced alignment tab character &.
:
---
output:
pdf_document
---
\begin{itemize}
\item `r "Guns & Roses"`
\end{itemize}