4

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

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

2 Answers 2

2

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*} 
2
  • You should use one "&" less (usually there should be an odd number of &'s.) Commented Nov 1, 2010 at 13:23
  • @Hendrik: Thanks, you are right. I edited the answer to fix that. Commented Nov 1, 2010 at 16:32
1

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.

You must log in to answer this question.