简体   繁体   English

如何在R Markdown中使用Latex复制这些矩阵

[英]How to replicate these matrix using Latex in R Markdown

I'm a newbie to R and I'm currently writing a markdown for a project. 我是R的新手,我正在为一个项目写下降价。 However, I'm facing a problem in reproducing the following matrices: 但是,我在复制以下矩阵时遇到了问题:

https://imageshack.com/i/f02dxhpHp https://imageshack.com/i/p1X5khBRp https://imageshack.com/i/f02dxhpHp https://imageshack.com/i/p1X5khBRp

In particular, can you please tell me how to reproduce the curly brackets? 特别是,你能告诉我如何重现大括号吗?

The code that i wrote so far is: 我到目前为止写的代码是:

\begin{equation*}
\mathbf{A_{eq}} =
\left[ \begin{matrix}
1 & 1 & \ldots
& 1 & & 0 & & 0 & \ldots
& 0 \\
w_1 & w_2 & \ldots
& w_n & & 0 & & 0 & \ldots
& 0\\
\end{matrix} \right] 
\mathbf{a_{eq}} =
\left[ \begin{matrix}
1 \\
\bar{r} \\
\end{matrix} \right] 
\end{equation*}

These curly braces are made with the \\overbrace{<you_code>} command. 这些花括号是使用\\overbrace{<you_code>}命令创建的。 For deeper informations refer to page 250 of Guit guide (in Italian as your nick name suggest), you can find it here or the LaTeX section of Stackexchange. 有关更深入的信息,请参阅Guit指南的第250页(意大利语作为您的昵称建议),您可以在此处找到它或Stackexchange的LaTeX部分。 For non Italian speakers informations and examples about \\overbrace{} can be found here . 对于非意大利语的信息和关于\\overbrace{}例子可以在这里找到。

About to translate that code in markdown I see it a very hard task. 即将在markdown中翻译该代码我认为这是一项非常艰巨的任务。 My advice is to use R markdown and embed LaTeX code (which is the provided code) in it and knit it as PDF. 我的建议是使用R markdown并在其中嵌入LaTeX代码(这是提供的代码)并将其编织为PDF。 Your code will be rendered well because knitr PDF use pdfLaTeX as underneath engine. 您的代码将很好地呈现,因为knitr PDF使用pdfLaTeX作为引擎下方。 Of course if you will try to knit it as HTML you'll have a bad day and output will be a mess with pure LaTeX code not interpreted well. 当然,如果您尝试将其编织为HTML,那么您将度过糟糕的一天,输出将是一个混乱,纯粹的LaTeX代码不能很好地解释。

Edit 编辑

As Roberto pointed out \\overbrace{<you_code>} seems to not work with the standard (and "ancient") matrix environment. 正如Roberto指出的那样, \\overbrace{<you_code>}似乎不适用于标准(和“古代”)矩阵环境。

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

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