Asked
Active
Viewed 4,255 times
2 Answers
5
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} $$
Leucippus
- 1,636
-
-
One minor tweak: you might want
\lvert p_{i} \rvert, so as to space the absolute-value bars as left and right delimiters. – Davislor Nov 28 '20 at 06: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 ofalignin the first example is wrong. – Zarko Nov 28 '20 at 21:13
2
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}
Zarko
- 296,517
-
Neat! Curious to the thought behind the
\,extra space between the indices? – Holene Nov 28 '20 at 07:41 -
2@Holene, oh, they are superfluous ... deleted now. Thank you very much to point me on this. – Zarko Nov 28 '20 at 07:58



casesenvironment fromamsmath. – Davislor Nov 28 '20 at 06:34