# Chapter 6 Equations

## 6.1 Equation syntax

The syntax for equations is similar (but not identical) to LaTeX.

LaTeX code:

```
\begin{equation}
\label{eqn:friedman}
\left(\dfrac{\dot{a}}{a}\right)^2 + \dfrac{kc^2}{a^2} = \dfrac{8\pi G}{3}\rho
\end{equation}
```

Rmd code:

```
\begin{equation}
\left(\dfrac{\dot{a}}{a}\right)^2 + \dfrac{kc^2}{a^2} = \dfrac{8\pi G}{3}\rho
(\#eq:friedman)
\end{equation}
```

\[\begin{equation} \left(\dfrac{\dot{a}}{a}\right)^2 + \dfrac{kc^2}{a^2} = \dfrac{8\pi G}{3}\rho \tag{6.1} \end{equation}\]

You can also use the latex

format for equations. If you’re converting from LaTeX to markdown with pandoc it may convert equations to

which also works.

**LaTeX subequations and intertext**

I haven’t been able to get subequations and intertext to work in bookdown. LaTeX equations of the form

```
\begin{subequations}\begin{align}
\vec{E} &= \left( x,t \right)
\intertext{and in 3 dimensional space as}
\vec{E} &= \left( x,y,z,t \right)
\end{align}\end{subequations}
```

should be written as separate equations with the text between written outside the equation environment, e.g.

## 6.2 Equation numbers and labels

The syntax for the maths is the same, but the labelling changes. To label and equation add

just before `end{equation}`

. Only equations with labels will be numbered. If you don’t want numbers then don’t label the equations, but numbers are helpful.

## 6.3 Cross referencing equations

The syntax for cross-referencing equations is similar to sections and figures, i.e.

will give “Eqn. (6.1) is the Friedman equation”.