# Scenario

Plese see the screenshot below. The top table is produced using minipage-typed column and the bottom table is produced using m{}.

WITHOUT using \fboxsep approach (that was already answered here), how to modify the bottom table such that it looks like the top table?

# Minimal Code

\documentclass{article}
\usepackage{array,calc,longtable}

\tabcolsep=5mm
\arrayrulewidth=2pt

\newcolumntype{A}
{
>{\begin{minipage}{0.3\linewidth-2\tabcolsep-1.5\arrayrulewidth}%
\vspace{\tabcolsep}\centering}%
c%
<{\vspace{\tabcolsep}\end{minipage}}%
}

\newcolumntype{B}
{
@{}>{\centering}%
m{0.3\linewidth-0\tabcolsep-1.5\arrayrulewidth}%
<{}@{}%
}

\def\pic{\rule{2.5cm}{1cm}}
\begin{document}

\begin{longtable}{|*2{A|}}\hline
\pic & \pic \tabularnewline\hline
\end{longtable}

\begin{longtable}{|*2{B|}}\hline
\pic & \pic \tabularnewline\hline
\end{longtable}

\end{document}

-
Why do you need only one column type for all your examples? Where is the problem to use A für something and type B for math, type C for math with align, and type D for ...?? –  Herbert Jan 8 '11 at 18:47
@Herbert: This question is related to your and @Leo's comment in another question (tex.stackexchange.com/questions/8437/…). Shortly speaking, I want to remove minipage-typed column if m{} can produce the same output. Creating distinct column type for each column (as you said above) has already been considered recently. :-) –  xport Jan 8 '11 at 18:56
And why, exactly, did this beg another question? It is redundant. Excess. –  morbusg Jan 8 '11 at 19:24
@morbusg, I want to remove minipage and change it to m{}. –  xport Jan 8 '11 at 19:28

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

\tabcolsep=5mm
\arrayrulewidth=2pt

\newcolumntype{A}
{
>{\begin{minipage}{0.3\linewidth-2\tabcolsep-1.5\arrayrulewidth}%
\vspace{\tabcolsep}\centering}%
c%
<{\vspace{\tabcolsep}\end{minipage}}%
}

\newsavebox\TBox
\newlength\THeight
\newlength\TWidth

\newenvironment{saveTBox}[1][0.5\linewidth]
{\begin{lrbox}{\TBox}\varwidth{#1}}
{\endvarwidth\end{lrbox}%
\minipage[c][\THeight][c]{\TWidth}\centerline{\usebox\TBox}\endminipage}

\newcolumntype{B}{@{}>{\saveTBox}c<{\endsaveTBox}@{}}

\def\pic{\rule{2.5cm}{1cm}}
\begin{document}

\begin{longtable}{|*2{A|}}\hline
\pic & \pic \tabularnewline\hline
\end{longtable}

\begin{longtable}{|*2{B|}}\hline
\pic & \pic \tabularnewline\hline
\end{longtable}

\end{document}


-
@Herbert, why does it become more complicated? Actually I am interested in changing minipage-typed to m{}. :-) –  xport Jan 8 '11 at 19:23
@xport: it depends to the contents. If the contents has is no displayed or has no linebreaks it can be done easier as already posted multiple times. –  Herbert Jan 8 '11 at 19:43
@Herbert, thanks for this solution. Tomorrow I will revisit this again. I noticed the column width expands automatically that might break my real scenario. –  xport Jan 8 '11 at 20:23
@Herbert: There is one thing that looks "strange", i.e., the equation number gets displaced to the left from the original position. Is there a trick to make the equation number still in the correct position? –  xport Jan 10 '11 at 14:31
@xport: columntype A or B? The align environment works only for cilumntype A –  Herbert Jan 10 '11 at 15:27
show 1 more comment