I want to build an array and refer to it as with equations. The array consists on two lines; however, I would like to refer it as only one.
My code is the following:
\documentclass[12pt,twoside,openright,a4paper]{book}
\usepackage{amsmath}
\begin{document}
As shown in Equation \ref{eq:2} ...
\begin{eqnarray}\label{eq:2}
H_0: \ h(\mathbf{X}) = 0 \\
H_1: \ h(\mathbf{X}) \neq 0
\end{eqnarray}
\end{document}
I get two equation numbers — one for each line. An alternative object type or any possible solution in order to get the formula in two lines but with only one equation number?
Best Answer
with use of the package
amsmath
:note:
eqnarray
is deprecated for long time. rather use math environments provided by the packageamsmath
:
), than instead ofaligned
you should usegathered
(as suggested Mico in his comment below):(in your case since of equation has equal width the result is the same as before).
edit: the package
amsmath
define also options for placement of equation numbers ataligned
ansgathered
math environments (as pointed Bernard). for example atgathered
we can write and obtain:for more options and details for the package
amsmath
please read its documentation. it is part of anylatex
installation. also it is worth to read documentation for the packagemathtools
which is extension ofamsmath
.