The goal is to obtain a table with fixed height rows, and to place the material inside -certain- cells vertically centered.
Looking for a robust and simple way, I have worked on this idea:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\def\text{This is a text example inside a cell}
\newcommand{\cell}[2]{\parbox[t][#1][c]{4cm}{#2}} % <- '4cm' fixed!
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{tabularx}{\textwidth}{|X|C|}
\hline
\text & \cell{2cm}{\text} \\
\hline
\end{tabularx}
\end{document}
(Similar to this approach using minipage
.)
At this point, I would like to use the width of each column into my \cell
command, in order to replace the fixed "4cm" definition by the generic column width values.
What I am looking for, if possible, is to get the "current" witdh column register used by tabularx, tabular or array, and to use it like an \parbox
argument. This will also be necessary to use \includegraphics [width = x]
inside the cells.
For example, you can do it successfully with the paracol package:
\documentclass{article}
\usepackage{paracol}
\begin{document}
\def\text{This is a text example inside a cell}
\columnratio{0.8}
\begin{paracol}{2}
\parbox[t][2cm][c]{\csname pcol@columnwidth\number1\endcsname}{\text}
\end{paracol}
\end{document}
\hsize=\hsize
in\newcolumntype{C}{>{\hsize=\hsize\centering\arraybackslash}X}
?