I am having trouble rendering some Latex code with R Markdown in HTML using the excellent xaringan R package. Specifically I would like to label the rows and columns of a matrix as described here. The thing is that, as far as I understand, some Latex packages cannot be used in R Markdown. Therefore, I am using a <div class="math">My matrix in Latex here</div>
. I'm almost there but I keep getting random opening single quotes that I cannot get rid of:
Must be something silly. Any help would be much appreciated.
The Rmd code is as follows:
---
title: 'Matrix'
output:
xaringan::moon_reader
---
<div class="math">
\[
\begin{array}{cc} &
\begin{array}{ccc} a & b & c
\end{array}
\\
\begin{array}{ccc}
p \\
q \\
r
\end{array}
&
\left(
\begin{array}{ccc}
.1 & .1 & 0 \\
.4 & 1 & 0 \\
.8 & 0 & .4
\end{array}
\right)
\end{array}
\]
</div>
This is a bug of xaringan. A workaround is to move
\end{array}
to the end of the previous line, e.g.,