Using latex packages in Rmarkdown for HTML rendering?

Is it possible to use latex packages in an Rmarkdown to be knit as an HTML? The following reproducible example works with the PDF format, but not with HTML. Matrix 1 is a simple latex matrix which does not require any extra package, but matrix 2 makes use of the blkarray and amsmath packages.

---
title: "test"
author: ""
date: "9/26/2019"
header-includes:
- \usepackage{blkarray}
- \usepackage{amsmath}
output: bookdown::html_document2
---

\```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
\```

# Matrix 1

\begin{bmatrix}
1 & 1 \\
0 & 0
\end{bmatrix}

# Matrix 2

\begin{blockarray}{cccccc}
a & b & c & d & e \\
\begin{block}{(ccccc)c}
1 & 1 & 1 & 1 & 1 & f \\
0 & 1 & 0 & 0 & 1 & g \\
0 & 0 & 1 & 0 & 1 & h \\
0 & 0 & 0 & 1 & 1 & i \\
0 & 0 & 0 & 0 & 1 & j \\
\end{block}
\end{blockarray}

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