I'm currently trying to knit a RMarkdown document to pdf, however, I keep getting an error. I've managed to figure out which bit of my code is causing the error, however, the code is displaying correctly when I preview the file or knit it to a html file. I can knit the file to pdf when I remove this block of code, but not sure why it won't work correctly. Here is the code:
$$
\begin{align}
R_{t+1} &= R_{t} + \alpha R_{t} - \beta R_{t}F_{t} \label{eq1} \tag{1} \\
F_{t+1} &= F_{t} + \beta R_{t}F_{t} - \gamma F_{t} \label{eq2} \tag{2}
\end{align}
$$
And here is the error I get:
! Package amsmath Error: Erroneous nesting of equation structures; (amsmath) trying to recover with `aligned'.
Further to the error, I've tried to altering the code to the following:
$$
\begin{aligned}
R_{t+1} &= R_{t} + \alpha R_{t} - \beta R_{t}F_{t} \label{eq1} \tag{1} \\
F_{t+1} &= F_{t} + \beta R_{t}F_{t} - \gamma F_{t} \label{eq2} \tag{2}
\end{aligned}
$$
However, when I do this, the equation doesn't display correctly in the html document.
$$
, it is enough to just use thealign
environment – user20650