简体   繁体   中英

LaTeX stretching tabular/array to fill 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

I wonder if instead of l and r you might consider trying p{width} for your alignment. This works okay for me:

\begin{tabular}{p{0.45\textwidth} p{0.5\textwidth}}
$\phi$$_{\mathrm{CJ}}$^* = \Sum$_{\mathrm{SV}}$ $\psi$$_{\mathrm{CSJV}}$ = P(S) P(S \&     V,C,S,J)  &  (no summation on S or V which are in evidence.)  \\
\end{tabular}

p{width} allows you to set the column width and try to fill your page, whereas I think l and r have some other (perhaps goofy) method of deciding how wide to make things.

In your equation you have P(S) P(S & V,C,S,J) and I needed to change that & to a \\& to stop it from thinking it was the beginning of another column...

There's a ditty on \\eqmakebox on the LaTeX/Tables Wikibook site that sounds like it might help as well, though it's a bit esoteric compared to something common like \\tabular... ( LINK ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM