# Minimal CODE

\documentclass{article}
\usepackage
{%
array,
calc,
amsmath,
longtable,
varwidth%
}

\newsavebox\TBox
\newcolumntype{B}[1]
{%
@{}%
>{\begin{lrbox}{\TBox}\varwidth{\linewidth}}%
m{#1\linewidth-1.5\arrayrulewidth}%
<{%
\endvarwidth\end{lrbox}\fboxrule=0pt%
\fboxsep=15pt\fbox{\usebox\TBox}%
}%
@{}%
}

\begin{document}

\begin{longtable}{|*2{B{0.5}|}}\hline
\begin{align}
a &= b
\end{align}
& c \tabularnewline\hline
\end{longtable}

\end{document}


How to avoid & conflict when using \begin{align} in a tabular cell?

-
Put the environment into braces {...}. However there will be a problem with the equationnumber. A number makes no real sense to me. Do you really need it? – Herbert Jan 8 '11 at 15:53
@Herbert, my real scenario is to create INPUT-OUTPUT table. Input cell contains the LaTeX code and the OUTPUT cell contains the corresponding output. When I want to show \begin{align}, the output should provide the proper output. :-) – xport Jan 8 '11 at 15:56
If you want to create INPUT-OUTPUT table, maybe you should just use minipage instead of tabular. – Leo Liu Jan 8 '11 at 16:47
the align environment is buggy when you want to cut off the surrounding white space, see page 74 in http://mirror.ctan.org/info/math/voss/mathmode/Mathmode.pdf. Use only the m column type without a parbox or minipage – Herbert Jan 8 '11 at 17:52

If you use \parbox or minipage within the cell, the & works as expected and you would get also the equation number. For example:

\begin{longtable}{|*2{B{0.5}|}}\hline
\parbox{.5\linewidth}{%
\begin{align}
a &= b
\end{align}}
& c \tabularnewline\hline
\end{longtable}


-
thanks for answering. Both Herbert's and your solutions work. – xport Jan 8 '11 at 17:50