The context for this question is that I would like to vertically align text in a tabular.
I.e. I would like to choose whether the text is:
- as close as possible to the top of the cell, or;
- as close as possible to the bottom of the cell, or;
- in the middle of the cell.
This is not what TeX means by "alignment", but it is what I mean here.
One way to do this is
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{array}
\usepackage{graphicx}
\begin{document}
\begin{tabular*}{4cm}{ p{4cm} }
\hline
\parbox[m][1.8cm][t]{4cm}{Some top-alignedcontent.} \\
\hline
\parbox[m][1.8cm][c]{4cm}{Some middle-aligned content.} \\
\hline
\parbox[m][1.8cm][b]{4cm}{Some bottom-aligned content.} \\
\hline
\end{tabular*}
\end{document}
This aligns the middle of the parbox to the cell baseline. It then aligns the text within the parbox either to the top, the middle, or the bottom.
But, that assumes that I can set the row height at 1.8 cm. In other cases, there are may be previous columns in the table which have fixed the row height. So, is there a way I can find out the current row height in a table?
Here's an example of what I mean:
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{array}
\usepackage{graphicx}
\begin{document}
\begin{tabular*}{4cm}{ p{4cm} p{4cm} }
\hline
There could be any old stuff here... &
\parbox[m][1.8cm][t]{4cm}{Some top-aligned content.} \\
\hline
... of any width or height... &
\parbox[m][1.8cm][c]{4cm}{Some middle-aligned content.} \\
\hline
... is there a variable I can use in the height argument to parbox,
which will ensure it fits the whole cell height? &
\parbox[m][1.8cm][b]{4cm}{Some bottom-aligned content.} \\
\hline
\end{tabular*}
\end{document}
What should I put instead of "1.8cm" in the parbox's height argument?



\parboxhasn't optionm, instead it usec, i. e.: change your table code to:\begin{tabular*}{4cm}{l} \hline \parbox[t][1.8cm][t]{4cm}{Some content.} \\ \hline \parbox[t][1.8cm][c]{4cm}{Some content.} \\ \hline \parbox[t][1.8cm][b]{4cm}{Some content.} \\ \hline \end{tabular*}– Zarko Mar 20 '17 at 12:50\parboxhasn't got anmoption but perhaps you are just looking for themcolumn type and no nested parbox at all? – David Carlisle Mar 20 '17 at 13:12