You are on page 1of 5

Inline and Display Equations

Marko Dimitrov, ProbablyMaxy, marko.dimitrov@quizlet.com

Introduction
The following instructions could be used as an OverLeaf project where the code
can be found on the left side, while the output is on the right side.

There are two types of mathematical equations, expressions, and formulas -


inline and displayed equations. Inline formulas could be displayed as a2 +b2 = c2
using command
$ a ^2 + b ^2 = c ^2$
As an Rinline formula,
Pn fractions, integrals, sums, and limits can be written as
4/2, 42 , x2 dx, i=1 n2 , limx→3 x2 . Note that within the paragraph the follow-
Z n
4 X
ing should be avoided , x2 dx, n2 , lim x2 . Notice the extra space between
2 i=1
x→3

sentences within the paragraph.

The display formula can be numbered


a2 + b2 = c2 (1)
or unnumbered
a2 + b2 = c2 .
When referring to an equation, the numbered display formula should be used.
The reference to the equation should be done as ‘Formula given in Eq. (1) is
known...‘.

Inline equations
The simplest mathematical formulas and symbols should be written between
dollar signs. KaTeX has a great way of dealing with extra spaces around the
inline equation. A couple of examples follow: -3+2=1 should be written as
−3 + 2 = −1; fractions as 23 or 3/2, (2x − y)/(32 + x), a − b = 3c2 , [1, 2]. That
is, use the default spacing system most of the time.

Using display style will create unnecessary spaces between sentences in para-
Z n
3 X
graphs and should be avoided. Examples: , x2 dx, n2 .
2 i=1

The default line break when using inline equations can be wrong. That is,
KaTeX/Markdown might force a line break where it should not be. To avoid
that, see the following examples

1
• Command
$ y =3$ ,$ -4$ , or $5$

should be used instead of


$ y =3 , -4 ,$ or $5$

Besides the line breaking, style of commas and spacing changes between
dollar signs;
• Command
$ y _1$ ,$ y _2$ ,$\ ldots .$$

should be used instead of


$ y _1 , y _2 , \ ldots .$

• Command
$ A (0 ,0) $

should be used instead of instead of


$ A (0$ ,$0) $

The line break could happen after ”A(0,”. Break after commas can occur
in previous examples, but not here as A(0, 0) should not be broken.
Formulas or equations that require use of three dots, the appropriate way to use
them is given below
y1 + y2 + · · · + yn
y1 · y2 · . . . · yn
Y1 × Y2 × · · · × Yn
y1 = y2 = · · · = yn
h(y1 , y2 , . . . , yn )
y1 y2 . . . yn
(a − b)(a − b)2 . . . (a − b)n
m(m − 1) . . . (1)
using the following commands, respectively,
$ y _1 + y _2 + \ dots + y _ n $
$ y _1 \ cdot y _2 \ cdot \ ldots \ cdot y _ n $
$ Y _1 \ times Y _2 \ times \ dots \ times Y _ n $
$ y _1 = y _2 = \ dots = y _ n $
$ h ( y _1 , y _2 , \ dots , y _ n ) $
$ y _1 y _2 \ dots y _ n $
$( a - b ) ( a - b ) ^2 \ dots ( a - b ) ^ n $
$ m (m -1) \ dots (1) $

2
Display Equations
The same formulas could be written in a display style. The display style implies
that the equation will be centered individually, separated from the paragraph.
The simplest formulas could be written using dollars as
x2 + 2 = 3,
or using align environment as
a2 + b2 = c2 .
Note that in our editor, the command is
$$
\ begin { align *}
a ^2 + b ^2 = c ^2
\ end { align *}
$$
There are multiple environment that can be used to get the same output.

Equation numbering should be done only when the particular equation is used
in the explanation. KaTeX has limited use of tagging. That is, you can tag
every equations within the environment
a2 + b2 = c2 (2)
2 2 2
d +e =f (3)
using command
$$
\ begin { align }
a ^2 + b ^2 & = c ^2 \\
d ^2 + e ^2 & = f ^2
\ end { align }
$$
or you may tag all equations using command
$$
\ begin { align *}
a ^2 + b ^2 & = c ^2 \ tag {4}\\
d ^2 + e ^2 & = f ^2
\ end { align *}
$$
There does not exist a way to tag only one equation from a group of equations
given within the align environment. You may separate the equation you want
to tag from the group with a full sentence and tag it.

Break a display style equation only when you must. The following are general
rules that should be applied when writing a display style equation or expression

3
• The equations should be align with the equality sign (<, >, ≤, ≥, . . . )

h(y1 , y2 , . . . , yn ) = y1 + y2 + · · · + yn
= 1 + 2 + · · · + 10
10 · (10 − 1)
=
2
= 45

using command
$$
\ begin { align *}
h ( y _1 , y _2 , \ dots , y _ n )
& = y _1 + y _2 + \ dots + y _ n \\
& = 1 + 2 + \ dots + 10 \\
& = \ frac {10 \ cdot (10 -1) }{2} \\
& = 45
\ end { align *}
$$

• When the equations is too long and needs to be broken, that can be done
in the following way

h(y1 , y2 , . . . , yn ) = y1 + y2 + · · · + yn + y1 + y2 + · · ·
+ yn + y1 + y2 + · · · + yn
= 1 + 2 + · · · + 10 + 1 + 2 + · · ·
+ 10 + 1 + 2 + · · · + 10
10 · (10 − 1)
=3·
2
= 135

using command
$$
\ begin { align *}
h ( y _1 , y _2 , \ dots , y _ n )
& = y _1 + y _2 + \ dots + y _ n + y _1 + y _2 + \ cdots
\\
& \ phantom {=} + y _ n + y _1 + y _2 + \ dots + y _ n \\
& = 1 + 2 + \ dots + 10+ 1 + 2 + \ cdots \\
& \ phantom {=} + 10 + 1 + 2 + \ dots + 10 \\
& = 3\ cdot \ frac {10 \ cdot (10 -1) }{2} \\
& = 135
\ end { align *}
$$

• When the equation includes larger brackets and you need to break an
equation, since commands

4
\ left ( , \ right )

do not necessary work, the following structure should be used

y1 = y0 + y02 + y03 + y04 + y05 + y06 + y07


y0  2 2  2
+c y0 + 1 + y02 + 2
2
!
 2  2
2 2
+ y0 + 3 + y0 + 4

using command
$$
\ begin { align *}
y _1 & = y _0 + y _0^2 + y _0^3 + y _0^4 + y _0^5 + y _0^6
+ y _0^7 \\
& \ phantom {=} + c \ Biggl ( \ frac { y _0}{2}\ Bigl ( y _0^2
+ 1\ Bigr ) ^2 + \ Bigl ( y _0^2 + 2\ Bigr ) ^2 \\
& \ phantom {= + c \ Biggl (} + \ Bigl ( y _0^2 + 3\ Bigr ) ^2
+ \ Bigl ( y _0^2 + 4\ Bigr ) ^2\ Biggr )
\ end { align *}
$$

Align environment can be used in the following ways (notice that align is with
the equality sign)

a−b=3 b = a2 3=2+1
2
a−b=3 b=a 3=2+1

using command
$$
\ begin { align *}
a-b & = 3 & b & = a ^2 &3 & = 2 + 1 \\
a-b & = 3 & b & = a ^2 &3 & = 2 + 1
\ end { align *}
$$

You might also like