knitr::opts_chunk$set(echo = TRUE)
library(matlib)
HTML documents use a different notation for labels and equation references. This is the cannonical way.
\begin{equation} (\#eq:binom) f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k} \end{equation} The equation \@ref(eq:binom) ...
which gives
\begin{equation} (#eq:binom) f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k} \end{equation}
The equation \@ref(eq:binom) ...
Eqn()
now detects that an HTML document is being compiled and changes the labels to match. This means that \@ref(eq:binom)
should be used instead of the LaTeX \ref{eq:binom}
way.
Eqn("\\mathbf{X} = ", latexMatrix())
Can I reference this as: See \@ref(eq:X)
ref()
Much like using \label{eqn:lab}
for \LaTeX\ and \(#eq:lab)
for HTML, switching between \ref{.}
and \@ref(.)
is a little annoying. Instead, you can use ref('eq:label')
to create the correct reference form regardless of the output type.
For example, reference the previous equation "eq:X"
via the r
inline mode with ref("eq:X")
gives r ref("eq:X")
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.