How do I define a column type so that, in a table, in every cell of every column of that type, the contents is bottom-aligned? (This contents is some text, not an image.)
I don't want every cell in the table bottom-aligned. I want the contents of every cell of the leftmost column top-aligned (which indeed happens because it is the default; no problem there). But by contrast I want the contents of every cell of the rightmost column bottom-aligned.
I have tried to adapt suggested methods in three answers, as shown below. The MWE below shows three attempts. In each, I restrict the second column's width and put so much text in the cell that it spills over to a second line. This makes bottom-alignment in the rightmost column distinguishable from top-alignment. I want the rightmost column's type defined so that the rightmost cell's contents is bottom-aligned. However, in each case the text is set too high.
Just in case it's relevant: I'm typesetting using LuaLaTeX.
MWE:
\documentclass[12pt,a4paper]{article}
\usepackage{array, tabularx}
% See https://tex.stackexchange.com/a/395359
% This is worse for 2 reasons: 1) the \hline at the bottom of the table doesn't compile 2) the s cells' contents is even higher than the other cells'.
\newcolumntype{s}{>{\centering}b{.2\textwidth}}
% See https://tex.stackexchange.com/a/105671
% This top-aligns cell 3's contents within its cell, rather than bottom-aligning it.
%\def\tabularxcolumn#1{b{#1}}
% See https://tex.stackexchange.com/a/244213 re col type X and right-hand col. \centering horizontally centres the contents between left and right, but the contents is still top-aligned.
\renewcommand\tabularxcolumn[1]{>{\centering\arraybackslash}b{#1}}
\begin{document}
\begin{tabular}{lp{5cm}|b{3cm}|}
\hline
first & using the built-in tabular environment & last\
\hline
\end{tabular}
\begin{tabular}{lp{5cm}|s|}
\hline
first & using a newly-defined column type s & last\
\end{tabular}
\begin{tabularx}{\textwidth}{lp{5cm}|X|}
\hline
first & using the package tabularx and its col type X & last\
\hline
\end{tabularx}
\end{document}




bnotmorp(I don't understand the comment above the commented outbuse) – David Carlisle Sep 29 '23 at 13:16bin my MWE's first{tabular}environment; the result is that the word "last" vertically aligns to the other cells' top lines, whereas I want it to align with the bottom line. I will correct a mistakenmto ab; however, even withm, the cell's contents vertically align to the other cell's top line rather than midway down. – Rosie F Sep 29 '23 at 13:51