In bookdown, is there a LaTeX math environment which numbers each equation, regardless of whether the ouptut is .pdf, .docx, .html? Adding this LaTeX:
\begin{align}
X &= Y \\
Z &= W
\end{align}
Into the bookdown-demo outputs the following:
PDF: works as expected.
DOCX: missing equation numbers.
HTML: missing equation numbers.
Notes:
- The output was generated using
pdf_book
,word_document2
,gitbook
. - This is related to an unanswered question of mine: Align environment in R Markdown which works for both docx and pdf output?
UPDATE: Merging Ralf's answer below along with other learnings of mine, in bookdown, the following all work consistently and as expected across .pdf, .docx, .html output.
Add a single un-numbered equation:
\begin{equation*}
X = Y
\end{equation*}
Add a single numbered equation:
\begin{equation}
X = Y
(\#eq:eq02)
\end{equation}
I refer to previous, equation \@ref(eq:eq02).
Add multiple un-numbered equations:
\begin{align*}
X &= Y \\
Z &= W
\end{align*}
Add multiple equations with numbering for each:
\begin{align}
X &= Y (\#eq:eq05)\\
Z &= W (\#eq:eq06)
\end{align}
I refer to previous, equation \@ref(eq:eq05) and equation \@ref(eq:eq06).
Add multiple equations with a single numbering for all:
\begin{equation}
\begin{aligned}
X &= Y \\
Z &= W
\end{aligned}
(\#eq:eq04)
\end{equation}
I refer to previous, equation \@ref(eq:eq04).