19

I am trying to create a multi-line equation in RMarkdown. I have tried the following code, extracted from http://www.rstudio.com/ide/docs/authoring/using_markdown_equations,

$$
\begin{aligned}
  \dot{x} & = \sigma(y-x) \\
  \dot{y} & = \rho x- y - xz 
\end{aligned}
$$

however the knitred HTML document gives a single-line equation:

screen shot of single line equation from html

user1420372
  • 2,077
  • 3
  • 25
  • 42

2 Answers2

4

This code produced 2 HTML lines, as desired, when cut and paste into RStudio in Windows 7 with knitr. If the second slash at the end of the 3rd line was removed, it produced the result shown in example.

Charlie
  • 181
  • 1
  • 4
  • Do you mean as follows: $$ \begin{aligned} \dot{x} & = \sigma(y-x) \ \dot{y} & = \rho x- y - xz \end{aligned} $$ because if so, I still get the same result as above. I also have Windows 7, R Studio 0.98.484 and I am using R version 3.0.2 (32-bit) – user1420372 Jan 15 '14 at 23:48
  • With R v3.0.2 (64-bit), Windows 7, RStudio 0.98.490 & knitr v1.5, when the code you provided above was copied and pasted into RStudio with no changes, it produced two lines of equations. Also worked properly when code was typed in. As a test, when the 2nd backslash was deleted at the end of the 3rd line of code (\dot{x} & = \sigma(y-x) \\), it produced the single line equation you provided as an example. – Charlie Jan 16 '14 at 03:38
  • 9
    ```$$\begin{eqnarray} a^2 + b^2 &=& c^2 \\ &=& 5 \end{eqnarray}$$``` works in my environment. – user51966 Mar 21 '16 at 15:46
0

I'm using markdown with Logseq and in this environment simply entering $$ \dot{x} = \sigma(y-x) \\ \dot{y} = \rho x- y - xz $$, allowed me to enter multi-line equations. Note the I removed the begin and end of the original message and also the &'s.

Castel
  • 21
  • 2