# Expand tabular/array to page width

I recently have had the need to make a math array or a tabular expand to fill the page width.

The effect I am trying to achieve is that for one line on the page, half is aligned at the left, and the other at the right.

For instance, just now, the following has been giving be problems...

$$\begin{array}{l r} \phi_{CJ}^* = \Sum_{SV} \psi_{CSJV} = P(S) P(S|V,C,S,J) & \text{(no summation on S or V which are in evidence.)} \end{array}$$


The desired effect is that the first cell is aligned on the left margin, and the second is aligned on the right margin. Instead, the array is centred, with no space between the cells.

Many thanks

-
Thank you both very much. My assignment is looking much better now that I've stopped abusing the array environment. – asdf Nov 1 '10 at 5:21
As a commend aside, you should avoid using  for equations – Juan A. Navarro Nov 1 '10 at 11:54

With the amsmath package, use the flalign or flalign* environment:

\begin{flalign*}
\phi_{CJ}^* = \sum_{SV} \psi_{CSJV} = P(S) P(S|V,C,S,J) &&& \text{(no summation on S or V which are in evidence.)}
\end{flalign*}

-
You should use one "&" less (usually there should be an odd number of &'s.) – Hendrik Vogt Nov 1 '10 at 13:23
@Hendrik: Thanks, you are right. I edited the answer to fix that. – Jan Hlavacek Nov 1 '10 at 16:32

Since you only want a single line set this way, the following works:

\hbox to \textwidth{$\displaystyle \phi_{CJ}^* = \sum_{SV} \psi_{CSJV} = P(S) P(S|V,C,S,J)$ \hfill
(no summation on $S$ or $V$ which are in evidence.)}


That is, set it as an hbox of length the width of the text, and put stretchable glue between the two expressions so that this is the part that gets stretch. The \displaystyle is to ensure that it is typeset as in a displayed equation rather than as an in-line equation.

-