2 Answers
One way is to use:
\begin{align}
p_{i \, j} = \begin{cases} \frac{1}{|p_{i}|} & \text{if $P_{i}$ links to $P_{j}$} \\
0 & \text{otherwise} \end{cases}
\end{align}
where align
is used for spacing around the equation(s) or an inline version is:
$$ p_{i \, j} = \begin{cases} \frac{1}{|p_{i}|} & \text{if $P_{i}$ links to $P_{j}$} \\
0 & \text{otherwise} \end{cases} $$
-
-
One minor tweak: you might want
\lvert p_{i} \rvert
, so as to space the absolute-value bars as left and right delimiters.– DavislorNov 28, 2020 at 6:39 -
2
-
Usage of
$$
is deprecated in LaTeX. Instead it you should use\[
and\]
or\begin{equation}
and\end{equation}
(see my answer). You should provide an MWE, which reproduce showed image. And let me repeat, your use ofalign
in the first example is wrong.– ZarkoNov 28, 2020 at 21:13
With use of cases*
and/or dcases?
defined in the mathtools
package and defining \abs{...}
as pair of delimiters for absolute value:
\documentclass[12pt]{article}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\begin{document}
\begin{equation}
p_{ij} = \begin{cases*}
\dfrac{1}{\abs{p_{i}}} & if $P_{i}$ links to $P_{j}$ \\
0 & otherwise
\end{cases*}
\end{equation}
or
\begin{equation}
p_{ij} = \begin{dcases*}
\frac{1}{\abs{p_{i}}} & if $P_{i}$ links to $P_{j}$ \\
0 & otherwise
\end{dcases*}
\end{equation}
\end{document}
cases
environment fromamsmath
.