开发者

Simple problem with alignment in Latex table

I have a simple alignment question for Latex tables. At the moment it looks as follows:

\begin{center}
  \begin{tabular}{| c | l | l | }
   \hline
    \tt {a} & $a = b + c + d + e + f + g + $ \\ 
        & $    e + f + g + h + i + j$ \\ \hli开发者_运维百科ne
    \end{tabular}
\end{center}

The problem is, that the output looks as follows:

a = b + c + ...
e + f + ....

However, I would like to have it looks as

a = b + c + ...
    e + f + ...

Anyone an idea how I could do that in a table?

Thanks, Klaus


Please use the align environment for multiline equations.


You can add a \phantom{a = } to indicate the should-be-existing spaces.

    & $\phantom{a = }e + f + g + h + i + j$ \\ \hline


As KennyTM pointed out, you shouldn't typeset multiline equations using tables like this. But if you must do it, you could do it like this:

\begin{center}
  \begin{tabular}{| c | l @{} l | }
   \hline
    \tt {a} & $a =\;$ & $b + c + d + e + f + g + $ \\ 
        & & $e + f + g + h + i + j$ \\ \hline
    \end{tabular}
\end{center}


The usual way is to make an additional column for the a = part; right-aligning it, and removing spacing with the next column for aesthetics:

\begin{tabular}{ c r @{} l } % you have one superfluous l
  \tt {a} & $a =$ & $b + c + d + e + f + g +$ \\ 
          &       & $e + f + g + h + i + j$ \\
\end{tabular}

Maybe you will need an explicit space after the = sign, so that it's properly spaced with the b.

Another solution would be to have a multiline equation in a single cell of the table, but that amounts to the same (you will need an array environment or something similar to wrap the left part).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜