2

MWE:

\documentclass[]{article}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}

\begin{document}
\pagenumbering{gobble}

\begin{center}

    \begin{tabular}{cp{7.5cm}p{2.4cm}}

        \textbf{L4} &
        For a sound explanation of both budget lines and indifference curves and a clear link to the separate demand curve, sound explanation of link between utility, price and demand, with accurate clear diagrams and a clear understanding of the principles involved. 
        &\textbf{[9--12]}\\
    \end{tabular}

\end{center}


\end{document}

With this code, the rightmost and leftmost columns have their text aligned to the top.

I would like the rightmost column (L4) to be aligned top, and the leftmost ([9--12]) to be aligned bottom.

How do I achieve this?

Thev
  • 1,568

2 Answers2

2

All that I did was to add &\\[-\normalbaselineskip]& between the 2nd and last columns on every row.

\documentclass[]{article}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}

\begin{document}
\pagenumbering{gobble}

\begin{center}

    \begin{tabular}{cp{7.5cm}p{2.4cm}}

        \textbf{L4} & 
        For a sound explanation of both budget lines and indifference curves and a clear link to the separate demand curve, sound explanation of link between utility, price and demand, with accurate clear diagrams and a clear understanding of the principles involved. 
        &\\[-\normalbaselineskip]&
        &\textbf{[9--12]}\\
        \textbf{L4} & 
        For a sound explanation of both budget lines and indifference curves and a clear link to the separate demand curve, sound explanation of link between utility, price and demand, with accurate clear diagrams and a clear understanding of the principles involved. 
        &\\[-\normalbaselineskip]&
        &\textbf{[9--12]}\\
    \end{tabular}

\end{center}


\end{document}

enter image description here

This can be codified in macro form (though it is particular to a 3-column tabular. Here, \lastbit{} is the macro:

\documentclass[]{article}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}
\def\lastbit#1{\\[-\arraystretch\normalbaselineskip]&&\textbf{#1}}
\begin{document}
\pagenumbering{gobble}
\begin{center}

    \begin{tabular}{cp{7.5cm}p{2.4cm}}

        \textbf{L4} & 
        For a sound explanation of both budget lines and indifference curves and a clear link to the separate demand curve, sound explanation of link between utility, price and demand, with accurate clear diagrams and a clear understanding of the principles involved. 
        &\lastbit{[9--12]}\\
        \textbf{L4} & 
        For a sound explanation of both budget lines and indifference curves and a clear link to the separate demand curve, sound explanation of link between utility, price and demand, with accurate clear diagrams and a clear understanding of the principles involved. 
        &\lastbit{[9--12]}\\
    \end{tabular}

\end{center}
\end{document}
  • This is pretty genius - I wasn't aware of this baselineskip! Also - it does seem very weird to me that tabular cannot have columns independently aligned as desired. – Thev Aug 27 '18 at 10:37
  • @TheveshTheva I had to use \normalbaselineskip, as \baselineskip is set to 0pt by the tabular environment. If you any \arraystretch active, there would require further modification. Alignment is a tricky thing, when you consider it has to account for letter descenders, etc. – Steven B. Segletes Aug 27 '18 at 10:42
0

Here is a solution with {NiceTabular} of nicematrix.

\documentclass[]{article}
\usepackage{nicematrix}
\usepackage{collcell}

\begin{document}

\newcolumntype{B}{>{\collectcell{\Block[B]{}}}r<{\endcollectcell}}

\begin{NiceTabular}{>{\bfseries}cp{7.5cm}>{\bfseries}B} L4 & For a sound explanation of both budget lines and indifference curves and a clear link to the separate demand curve, sound explanation of link between utility, price and demand, with accurate clear diagrams and a clear understanding of the principles involved.
& [9--12] \ L4 & For a sound explanation of both budget lines and indifference curves and a clear link to the separate demand curve, sound explanation of link between utility, price and demand, with accurate clear diagrams and a clear understanding of the principles involved.
& [9--12] \ \end{NiceTabular}

\end{document}

You need several compilations (because nicematrix uses PGF/TikZ nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250