I need a general solution for vertical align in tables. That is, a solution for texts and subtables inside the cells.
I try defining new column types like,
\newcolumntype{?}[1]{>{\raggedright\arraybackslash}?{#1}}
But is insuficient because can't predetermine the correct position of the content inside the cell.
Even worse if the contents of the cell is a table. The vertical alignment becomes blurred and unpredictable.
If vertical alignment is used within the subtables (like \begin{tabular}[t], the solution is not complete.
Therefore, I do not find a universal solution for vertically and horizontally aligning any content in a cell, in a predictable and reliable way.
Please, I need help for this purpose. The contents of the cells can be a text (multiline); a table; or mixed together.
The code used for the examples is as follows:
\documentclass{article}
\usepackage{array}
% Middle alignment
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
% Top alignment
\newcolumntype{T}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{U}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{V}[1]{>{\raggedleft\arraybackslash}p{#1}}
% Bottom alignment
\newcolumntype{E}[1]{>{\raggedright\arraybackslash}b{#1}}
\newcolumntype{F}[1]{>{\centering\arraybackslash}b{#1}}
\newcolumntype{G}[1]{>{\raggedleft\arraybackslash}b{#1}}
\newcommand{\subtableshort}{\begin{tabular}{ll}a&b\\c&d\end{tabular}}
\newcommand{\subtablecontrol}{\begin{tabular}{ll}a&b\\c&d\\e&f\\g&h\end{tabular}}
\newcommand{\subtableAlignedShort}[1]{\begin{tabular}[#1]{ll}a&b\\c&d\end{tabular}}
\newcommand{\subtableAlignedControl}[1]{\begin{tabular}[#1]{ll}a&b\\c&d\\e&f\\g&h\end{tabular}}
\newcommand{\txtshort}{Donec aliquet, erat ligula aliquet.\newline Suspendisse ut. }
\newcommand{\txtcontrol}{Nam dui ligula, fringilla euismod. \newline Morbi ac orci et nisl hendrerit mollis. Cras ante.}
\newcommand{\textExample}{\hline\txtcontrol&\txtshort&\txtshort&\txtshort\\[0.3in]\hline}
\newcommand{\tableExample}{\hline\subtablecontrol&\subtableshort&\subtableshort&\subtableshort\\\hline}
\newcommand{\alignedTableExample}[1]{\hline\subtableAlignedControl{#1}&\subtableAlignedShort{#1}&\subtableAlignedShort{#1}&\subtableAlignedShort{#1}\\\hline}
\begin{document}
\section{Example with texts}
Using
\begin{verbatim}
\newcolumntype{?}[1]{>{\raggedright\arraybackslash}?{#1}}
\end{verbatim}
\subsection{Middle}
\noindent\begin{tabular}{|L{1.2in}|L{1.2in}|C{1.2in}|R{1.2in}|}\textExample\end{tabular}
\subsection{Top }
\noindent\begin{tabular}{|T{1.2in}|T{1.2in}|U{1.2in}|V{1.2in}|}\textExample\end{tabular}
\subsection{Bottom}
\noindent\begin{tabular}{|E{1.2in}|E{1.2in}|F{1.2in}|G{1.2in}|}\textExample\end{tabular}
\subsection{Mixed}
\noindent\begin{tabular}{|E{1.2in}|L{1.2in}|T{1.2in}|E{1.2in}|}\textExample\end{tabular}
\section{Example with subtables}
\subsection{Middle}
\noindent\begin{tabular}{|L{1.2in}|L{1.2in}|C{1.2in}|R{1.2in}|}\tableExample\end{tabular}
\subsection{Top}
\noindent\begin{tabular}{|T{1.2in}|T{1.2in}|U{1.2in}|V{1.2in}|}\tableExample\end{tabular}
\subsection{Bottom}
\noindent\begin{tabular}{|E{1.2in}|E{1.2in}|F{1.2in}|G{1.2in}|}\tableExample\end{tabular}
\section{Example with aligned top subtables}
\subsection{Middle}
\noindent\begin{tabular}{|L{1.2in}|L{1.2in}|C{1.2in}|R{1.2in}|}\alignedTableExample{t}\end{tabular}
\subsection{Top}
\noindent\begin{tabular}{|T{1.2in}|T{1.2in}|U{1.2in}|V{1.2in}|}\alignedTableExample{t}\end{tabular}
\subsection{Bottom}
\noindent\begin{tabular}{|E{1.2in}|E{1.2in}|F{1.2in}|G{1.2in}|}\alignedTableExample{t}\end{tabular}
\section{Example with aligned bottom subtables}
\subsection{Middle}
\noindent\begin{tabular}{|L{1.2in}|L{1.2in}|C{1.2in}|R{1.2in}|}\alignedTableExample{b}\end{tabular}
\subsection{Top}
\noindent\begin{tabular}{|T{1.2in}|T{1.2in}|U{1.2in}|V{1.2in}|}\alignedTableExample{b}\end{tabular}
\subsection{Bottom}
\noindent\begin{tabular}{|E{1.2in}|E{1.2in}|F{1.2in}|G{1.2in}|}\alignedTableExample{b}\end{tabular}
\end{document}



