3

The \vfils in the following mwe seem to have no effect:

\documentclass{article}

\usepackage{tabularx} \usepackage{lipsum}

\begin{document}

\begin{tabularx}{\linewidth}{XX} \lipsum[1] & a \vfil b \vfil c\ \end{tabularx}

\end{document}

Is there a way to make this work? What I want is very similar to How to use the equivalent of a vfill in a tabular environment? except I don't know a priori what the height of column 1 will be (but it will always be at least the height of the column 2 without the \vfil). I suppose I could store the height of column 1 in a macro but is that the best way to do this? Solutions avoiding tabular(x) are also welcome.

ronno
  • 1,325

1 Answers1

4

You need to measure the left box.

\documentclass{article}

\usepackage{lipsum}

\newsavebox{\doubleleftbox} \newenvironment{doublebox} {% \begin{flushleft} \begin{lrbox}{\doubleleftbox} \begin{minipage}[b]{\dimexpr0.5\columnwidth-\tabcolsep}\strut\ignorespaces } {\unskip\strut\end{minipage}\end{flushleft}}

\newcommand{\changeside}{% \unskip\strut\end{minipage} \end{lrbox} \usebox{\doubleleftbox}\hfill \begin{minipage}[b][\ht\doubleleftbox][s]{\dimexpr0.5\columnwidth-\tabcolsep} \strut\ignorespaces }

\begin{document}

\lipsum[3][1-3]

\begin{doublebox} \lipsum[1] \changeside \lipsum[2][1-2]\vfil \lipsum[2][3-4]\vfil \lipsum[2][5-6] \end{doublebox}

\lipsum[4][1-3]

\end{document}

enter image description here

egreg
  • 1,121,712