Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Would simply using \notag in conjucture with \begin{align*} or \tag with \begin{align} solve your problem ? –  N3buchadnezzar Nov 18 '11 at 15:04
    
    
@N3buchadnezzar but then the tag won't be vertically centered if there's an even number of lines in the equation. –  Gonzalo Medina Nov 18 '11 at 15:12
add comment

3 Answers 3

up vote 10 down vote accepted

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

share|improve this answer
1  
You do not need align to get alignment, your example will work fine with an equation instead of align. –  Torbjørn T. Nov 18 '11 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. –  Gonzalo Medina Nov 18 '11 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 '11 at 16:08
add comment

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.

share|improve this answer
add comment

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}
share|improve this answer
1  
could also mention rcases from mathtools... –  cmhughes Mar 29 '12 at 8:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.