简体   繁体   English

rmarkdown 中的多行交叉引用方程 - 编织到 pdf

[英]Multiline cross-referenced equation in rmarkdown - knit to pdf

I'm trying to create rmarkdown pdf document and introduce a multiline equation in it.我正在尝试创建 rmarkdown pdf 文档并在其中引入多行方程。 Here is the header:这是 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?除了我无法使用@ref(eq:align交叉引用和(\#eq:align)随机出现在等式中之外,上述工作正常。有人可以建议我如何让它工作吗?

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 .这个想法是只使用 LaTeX 分配标签和引用\label\eqref的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM