I'm trying to create rmarkdown pdf document and introduce a multiline equation in it. Here is the header:
title: "Cross-referencing figures, tables, and equations"
author: "Generated by bookdown"
output:
pdf_document: default
bookdown::pdf_document2: default
bookdown::html_document2: default
I need to be able to cross-reference the equation and for it to be split among multiple lines as it's long. I've tried multiple different things by looking at other posts, with the latest being the following:
\begin{align}
g(X_{n}) &= g(\theta)+g'({\tilde{\theta}})(X_{n}-\theta) \notag \\
\sqrt{n}[g(X_{n})-g(\theta)] &= g'\left({\tilde{\theta}}\right)
\sqrt{n}[X_{n}-\theta ] (\#eq:align)
\end{align}
The above works fine apart that I can't cross-reference using @ref(eq:align, and (\#eq:align) randomly appears in the equation. Could someone advise as to how I can get this to work?
Thank you.
Does the following help?
\begin{align}
g(X_{n}) &= g(\theta)+g'({\tilde{\theta}})(X_{n}-\theta) \notag \\
\sqrt{n}[g(X_{n})-g(\theta)] &= g'\left({\tilde{\theta}}\right)
\sqrt{n}[X_{n}-\theta ] \label{eq:align}
\end{align}
As we see from \eqref{eq:align}, Pythagoras was right all along!
The idea is to just use the LaTeX method of assigning labels and referencing with \label and \eqref.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With