[Tex/LaTex] How to vertically-center the text of the cells

tablesvertical alignment

I have a simple table as follows:

\begin{table*}
    \centering
    \begin{tabular}{|l|c|c|c|c|p{2in}|}
    ...
    ...
    \end{tabular}
    \caption{The factors the camera solver depends on to evaluate the rules.}
    \label{table:factors}
\end{table*}

How is it possible to vertically-center the text of the cells?

Best Answer

Edit: The existence of this new answer has made my answer now obsolete and embarrassing. Please proceed to the new answer and vote it up.

enter image description here

\documentclass{article}
\usepackage[a4paper,vmargin=2cm,hmargin=1cm,showframe]{geometry}
\usepackage[demo]{graphicx}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage{longtable}

\parindent=0pt

\def\correction#1{%
    \abovedisplayshortskip=#1\baselineskip\relax\belowdisplayshortskip=#1\baselineskip\relax%
    \abovedisplayskip=#1\baselineskip\relax\belowdisplayskip=#1\baselineskip\relax}

\arrayrulewidth=1pt\relax
\tabcolsep=5pt\relax
\arrayrulecolor{red}
\fboxsep=\tabcolsep\relax
\fboxrule=\arrayrulewidth\relax

\newcolumntype{A}[2]{%
    >{\minipage{\dimexpr#1\linewidth-2\tabcolsep-#2\arrayrulewidth\relax}\vspace\tabcolsep}%
    c<{\vspace\tabcolsep\endminipage}}
    

\newenvironment{Table}[4]{%
    \longtable{%
        |A{#1}{1.5}% for figure
        |>{\centering$\displaystyle}A{#2}{1}<{$}% for inline equation
        |>{\correction{-1}\strut\[}A{#3}{1}<{\]\strut}% for displayed equation
        |>{\centering}A{#4}{1.5}% for text
        |}\hline\ignorespaces}{%
    \endlongtable\ignorespacesafterend}

\newcommand{\dummy}{%
    It is practically a big lie that \LaTeX\ 
    makes you focus on the content without
    bothering about the layout.}


\newcommand{\Row}{%
    \includegraphics[width=\linewidth]{newton}&
    \frac{a+b}{a-b}=0&
    \int_a^b f(x)\, \textrm{d}x=\frac{b-a}{b+a}&
    \fcolorbox{cyan}{yellow}{\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}{\dummy}}
    \tabularnewline\hline}

\begin{document}
\begin{Table}{0.25}{0.25}{0.25}{0.25}
\Row
\Row
\end{Table}

\def\x{\centering$\displaystyle\int_a^bf(x)\,\textrm{d}x=\frac{a-b}{a+b}$}

\longtable{|A{0.2}{1.5}*2{|A{0.25}{1}}|A{0.3}{1.5}|}\hline
\x & \x & \multicolumn{2}{A{0.55}{1.5}|}{\x} \tabularnewline\hline
\multicolumn{2}{|A{0.45}{1.5}|}{\x} & \x & \x\tabularnewline\hline 
\x & \multicolumn{2}{A{0.5}{1}|}{\x} & \x\tabularnewline\hline 
\multicolumn{4}{|A{1}{2}|}{\x}\tabularnewline\hline 
\endlongtable
\end{document}