11

i would like to write few equations, but all the equations will get only once numbered and in the middle (right side) of the equations. e.q. if i write 3 equations, the number will be to the right of the second equation line and if i have 2 equations, then the number will between the two equations and at the right side.

in addition i would like to have something like "&" (align) that i could align my equations at certain points.

Example:

a   = x_{ij}
                  (1)
b_j = y_j      

where of course the number of equation doesn't take a all line space.

3

3 Answers 3

13

The amsmath package provides the split environment. You can use a split environment inside an align environment or inside an equation environment; a little example:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
\begin{split}
  a   &= x_{ij} \\
  b_j &= y_j 
\end{split}
\end{align}

\end{document}

enter image description here

3
  • 1
    You do not need align to get alignment, your example will work fine with an equation instead of align. Nov 18, 2011 at 15:14
  • @TorbjørnT. Yes; however, for consistency reasons, I always use array when I use the alignment characters &. I will rephrase my answer. Nov 18, 2011 at 15:22
  • 2
    I wouldn't advise to use align other than when it's necessary and moreover the usage of split is "wrong", as LaTeX will never use \abovedisplayshortskip with it. With aligned inside equation it will, if the line preceding the alignment is short; this is preferable for a singly numbered display.
    – egreg
    Nov 18, 2011 at 16:08
19

The amsmath package has many facilities, among which the aligned environment that does similarly to align, but produces a block usable in a bigger formula:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{aligned}
  a   &= x_{ij} \\
  b_j &= y_j 
\end{aligned}
\end{equation}

\end{document}

What's the difference with split? That aligned, like align, allows many alignment points.

3

Although amsmath functionality is preferred, there are a multitude of ways this can be achieved. Here's one using only an array:

enter image description here

\documentclass{article}
\begin{document}
\begin{equation}
  \renewcommand{\arraystretch}{1.2}% To spread out the equations
  \begin{array}{r@{\;}l}
    a =& x_{ij} \\
    b_j =& y_j
  \end{array} \label{eq}
\end{equation}
\end{document}

It has the same layout - in terms of input - to the align environment. Moreover, it now also straight-forward to combine the equations using a brace (say) - achieved using a \left. and \right\} pair:

enter image description here

\documentclass{article}
\begin{document}
\begin{equation}
  \renewcommand{\arraystretch}{1.2}% To spread out the equations
  \left.\begin{array}{r@{\;}l}
    a =& x_{ij} \\
    b_j =& y_j
  \end{array}\right\} \label{eq}
\end{equation}
\end{document}

rcases (from mathtools) also provides the above functionality, but is usually intended for a different purpose. As such, the spacing/alignment is not as expected. One can use the undocumented \newcases to define a comparable alternative. Below I've adapted rcases to have a right-aligned first column, and introduce a \thickmuskip between the two "columns", similar to what one would expect around ordinary and relation atoms:

enter image description here

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\makeatletter
\newcases{Rcases}{$\mskip\thickmuskip$}{%
  \hfil$\m@th{##}$}{$\m@th{##}$\hfil}{.}{\rbrace}
\makeatother
\begin{document}
\begin{equation}
  \begin{Rcases}
    a   &= x_{ij} \\
    b_j &= y_j
  \end{Rcases} \label{eq}
\end{equation}
\end{document}
1
  • 1
    could also mention rcases from mathtools...
    – cmhughes
    Mar 29, 2012 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .