How to vertically center a content spanning multiple rows without using nested tables?
the package ltablex
is available on CTAN: http://www.ctan.org/tex-archive/macros/latex/contrib/ltablex
Three X columns must give 3X when you want to have different columns widths: 0.6+1.5+0.9=3
For the 2nd and 3rd row you have 2X+1X=3X
\documentclass{article}
\usepackage[a4paper,margin=1cm,showframe]{geometry}
\usepackage{multirow,bigstrut,ltablex,calc}
\parindent=0pt
\tabcolsep=5pt
\newcolumntype{A}[1]{>{\hsize=#1\hsize\rule{0pt}{\tabcolsep}\newline}
X
<{\newline\rule[-\tabcolsep]{0pt}{\tabcolsep}}}
\newcommand\x{\makebox[\hsize]{$\displaystyle\int f(x)\,\textrm{d}x=F(x)+C$}}
\begin{document}
\keepXColumns
\begin{tabularx}{\linewidth}{| A{0.6} | A{1.5} | A{0.9} |}\hline
\x & \multicolumn{2}{A{2.4}|}{\x} \tabularnewline\hline
%%%%%%%%%%%%%%% SECOND ROW %%%%%%%%%%%%%%%
\multicolumn{2}{|A{2}|}{\multirow{4}[8]{*}{\x}} & \x\tabularnewline\cline{3-3}
%%%%%%%%%%%%%%% THIRD ROW %%%%%%%%%%%%%%%
\multicolumn{2}{|A{2}|}{} & \x \tabularnewline\hline
\end{tabularx}
\end{document}
You could obtain the desired result with a simple modification to your original code, replacing \multirow{2}{*}{\x}
with \hfil\multirow{4}{*}{\x}\hfil
in the second row:
\documentclass{article}
\usepackage[a4paper,margin=1cm,showframe]{geometry}
\usepackage{array,multirow,longtable}
\parindent=0pt
\arrayrulewidth=1pt\relax
\tabcolsep=5pt\relax
\newcolumntype{A}[2]{%
>{\minipage{\dimexpr#1\linewidth-2\tabcolsep-#2\arrayrulewidth\relax}\vspace\tabcolsep}%
c<{\vspace\tabcolsep\endminipage}}
\newcommand\x{\centering$\displaystyle\int f(x)\,\textrm{d}x=F(x)+C$}
\begin{document}
\begin{longtable}{
|A{0.2}{1.5} % 0.2 of \linewidth, 1.5 of \arrayrulewidth
|A{0.5}{1} % 0.5 of \linewidth, 1 of \arrayrulewidth
|A{0.3}{1.5} % 0.3 of \linewidth, 1.5 of \arrayrulewidth
|}\hline
%%%%%%%%%%%%%%% FIRST ROW %%%%%%%%%%%%%%%
\x & \multicolumn{2}{
A{0.8}{1.5} % 0.8 of \linewidth, 1.5 of \arrayrulewidth
|}{\x} \tabularnewline\hline
%%%%%%%%%%%%%%% SECOND ROW %%%%%%%%%%%%%%%
\multicolumn{2}{
|A{0.7}{1.5} % 0.7 of \linewidth, 1.5 of \arrayrulewidth
|}{\hfil\multirow{4}{*}{\x}\hfil} & \x \tabularnewline\cline{3-3}
%%%%%%%%%%%%%%% THIRD ROW %%%%%%%%%%%%%%%
\multicolumn{2}{
|A{0.7}{1.5} % 0.7 of \linewdith, 1.5 of \arrayrulewidth
|}{} & \x \tabularnewline\hline
\end{longtable}
\end{document}
My proposed solution dispenses with minipages
and explicit \vspace
instructions. This is achieved by inserting a "strut" automatically in each row; the height of the strut exceeds that of the math expressions by a certain amount.
\documentclass{article}
\usepackage[a4paper,margin=1cm,showframe]{geometry}
\usepackage{array,multirow,tabularx}
\parindent=0pt
\arrayrulewidth=1pt
\tabcolsep=5pt
%% 'rbstrut' is short for 'really big strut'
\newcommand{\rbstrut}{\ensuremath{\vphantom{\displaystyle \int\limits_a^t}}}
\newcolumntype{A}[1]{>{\hsize=#1\hsize \centering \arraybackslash\rbstrut}X}
\newcommand\x{\ensuremath{\displaystyle\int f(x)\,\textrm{d}x=F(x)+C}}
\begin{document}
%% in tabularx terminology, the sum of the widths (arguments of A) have to
%% add up to the integer (in this case 3) that equals the number of columsn
\begin{tabularx}{\textwidth}{| A{0.6} | A{1.5} | A{0.9} |}
\hline
%%%% FIRST ROW
\x & \multicolumn{2}{c|}{\x} \\ \hline
%%%% SECOND ROW
\multicolumn{2}{|A{2.1}|}{ \multirow{4}{*}{\x} } & \x \\ \cline{3-3}
%%%% THIRD ROW
\multicolumn{2}{|c|}{} & \x \\ \hline
\end{tabularx}
\end{document}