My R Markdown (.Rmd) file looks like this:
---
title: Foo
author: Marius Hofert
header-includes:
- \\usepackage{bm}
output:
pdf_document
vignette: >
I think your \[ \]
and \begin{align} ... \end{align}
are redundant. When I ran it as written above I got
! Package amsmath Error: Erroneous nesting of equation structures; (amsmath) trying to recover with `aligned'.
See the amsmath package documentation for explanation. Type H for immediate help. ...
l.84 \end{align}
Worked fine for me when I deleted \begin{align} ... \end{align}
...
(It seems that a similar issue arose in your previous question too ...)
(Perhaps you were getting errors that you didn't notice and were accidentally looking at a previously compiled version?)
As far as why you don't get the right HTML output: I'm pretty certain that MathJax (the engine used to render LaTeX embedded in Rmarkdown-produced HTML) doesn't know about \boldmath; adding the package to your LaTeX input won't help, you'll have to use \mathbf
and \boldsymbol
instead. You can play around here to see what works and what doesn't: entering
$\bm X \boldmath X \boldsymbol X \mathbf X$
at that web page gives
Bottom line, if you want fancy math rendered properly, you're probably better off sticking to PDF output.