demonstration 2

By Jannik Buhr

January 1, 0001

Rendering mathematical equations

Examples from the mathjax demo:


In .Rmarkdown documents, you can use either

$a \ne 0$

to get inline math: \(a \ne 0\). There is no conflict with using dollar symbols regularly, because knitr automatically escapes freestanding dollar symbols.

And you can use

$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

to get a math paragraph:

$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$


In .md documents, you can not use the single dollar syntax. The double dollar syntax still gives you a math paragraph.

$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$

In order to get inline equations, use:

`\(a \ne 0\)`
\\(a \ne 0\\)

to get: \(a \ne 0\) or \(a \ne 0\).

Posted on:
January 1, 0001
1 minute read, 124 words
See Also: