[Tex/LaTex] Display math and tabular

math-modetables

I'm pretty new to latex and having some trouble.
I have multiple math formulas which I'd like to organize on the page.
i used:

\begin{tabular}{p{6cm}p{6cm}}
\[...\] & \[...\]\\
\end{tabular}

for this. The problem is the following one: the first formula has different indent depending on its own length (the second one is always on the same place).I guess it's the centering of the displaymath? Is there a way to have the display mode and always the same indent, or should I use another environment?

Best Answer

The problem is with the use of display math mode. Instead you could use inline math and specify \displaystyle:

enter image description here

If your tables only have math content then I would suggest using an array as in the last example above. Although, I am not sure why the spacing is slightly different.

Notes:

  • I am not advocating the user of vertical rules. They were added just to show where the content is with respect to the borders.

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}
\noindent
Using \verb|display math mode|

\noindent
\begin{tabular}{|p{6cm}|p{6cm}|}
\[ y =\sum_{i=0}^{n} i^2 \] & \[ y =\sum_{i=0}^{n} i^2  \] \\
\end{tabular}

\medskip\noindent
Using \verb|\displaystyle|

\noindent
\begin{tabular}{|p{6cm}|p{6cm}|}
$\displaystyle y =\sum_{i=0}^{n} i^2$ & $\displaystyle y =\sum_{i=0}^{n} i^2$ \\
\end{tabular}

\medskip\noindent
Using \verb|\displaystyle| with an \verb|array|:

\noindent
$\begin{array}{|>{$\displaystyle}p{6cm\relax}<{$}|>{$\displaystyle}p{6cm}<{$}|}
 y =\sum_{i=0}^{n} i^2 & \displaystyle y =\sum_{i=0}^{n} i^2 \\
\end{array}$


\end{document}