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.

To center align two equations, I need to place the & inside a \dfrac argument (I am using AMS LaTeX) but if do that, I get an error message and the code does not compile. The only alternative way I could get the result I want is using the following ugly hack below. Is there a clean way to use align in my case?

 \begin{align*}
 \hat W_i =\sum_{j\neq i} \hat G_j\tag{lsys}\end{align*}
 \vspace{-.8cm}
 \begin{align*}
 \hat G_i =\dfrac{\sum_{j\neq i} \hat W_j -(N-1)\hat W_i}{N}\tag{sol}
 \end{align*}
share|improve this question
1  
If you just want centering with no particular alignment, use the gather* environment instead of align*. –  Paul Gessler Jul 14 at 1:09
    
Thanks: first time I heard about gather* –  Sergio Parreiras Jul 14 at 1:10
add comment

1 Answer 1

up vote 5 down vote accepted

Converting my comment into an answer:

If centering of a group of equations is required, with no particular alignment, the gather environment (or its starred, unnumbered variant, gather*) should be used:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{gather*}
  \hat{W}_i =\sum_{j\neq i} \hat{G}_j \tag{lsys} \\
  \hat{G}_i =\frac{\sum_{j\neq i} \hat{W}_j -(N-1) \hat{W}_i}{N} \tag{sol}
\end{gather*}
\end{document}

enter image description here

Other notes: I've added a few explicit braces, and \dfrac is not required since we already have a display environment.

EDIT: As suggested in the comments, you could use \widehat for the "hats" on uppercase letters. I've also brought the denominator out front to give a consistent look to the summations.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{gather*}
  \widehat{W}_i = \sum_{j\neq i} \widehat{G}_j \tag{lsys} \\
  \widehat{G}_i = \frac{1}{N} \sum_{j\neq i} \widehat{W}_j - \frac{N-1}{N} \widehat{W}_i \tag{sol}
\end{gather*}
\end{document}

enter image description here

share|improve this answer
3  
You might also want to suggest the use of \widehat instead of \hat for the sake of creating "hat" symbols above uppercase letters. Ideally, the OP would implement such a change on a document-wide basis, i.e, for all uppercase letters that are to be given "hats". –  Mico Jul 14 at 4:50
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.