# Tabular column and line extend to page-height

I've got a table that splits a page with a vertical line. I'd like the table's total height to be that of the page, and in particular have the vertical line down the center extend from the midline to the bottom of the page.

Here's example code:

\documentclass[oneside,12pt]{memoir}

\begin{document}

\begin{tabularx}{\stockwidth}{X|c}

\multicolumn{2}{c}{A: Main heading - variable height} \\ \midrule%
X: (This side blank) & \textbf{B: Mid heading} \\ %
\cline{2-2} \\ [1ex]%
& C: Mid Content (may be any height) \\ [1ex] \cline{2-2} \\%
& \parbox{5cm}{D: This content may be short or long, but in any %
case the line on the left %
should go to the bottom of the page.}

\end{tabularx}

\end{document}


It looks something like this (and I'd like that middle vertical line to extend to the bottom of the page):

I'd like to use \vfil or some such to extend D to the height of the page, but I'm just not sure how to use it for that. That would seem to solve the primary problem.

Here are some of the strange constraints:

• A can be any height. It starts 1cm from the top of the page, 1cm from the margin, and there's a 1 cm margin at the bottom.

• C can be any height up to around 5cm (but it should only expand to that size if necessary).

• D might be one of two or three fixed sizes (e.g. 3cm, 6cm or 9cm)

• X is the page width minus the width of D, but in any case not less than 50% of the width of the page (i.e. if D is bigger than 50% of the page, D has to wrap or some such).

• This is all inside a textblock* (from textpos) that's been rotated by 90 degrees (i.e. on a landscape page in an otherwise portrait document) and sized to \stockwidth - 2cm; I've not reproduced this to try and keep this simple.

How can one extend the vertical line to the bottom of the area (in this case a textblock)?

Thanks for reading.

-
Is the eventual output a single-page document with the above constraints? Or does it form part of a larger document with content preceding/following it? –  Werner Nov 9 '11 at 20:47
@Werner: It is part of a larger, portrait-oriented document with content preceding it (but likely not following it). –  Brian M. Hunt Nov 9 '11 at 20:49

## 2 Answers

Here is an attempt using a combination of geometry (for layout purposes) and multicol.

Putting your content in a multicols environment allows you to play around with the lengths without problem, since the text will expand as necessary. In the minimal example (given below), the following graphic only shows the last 2 pages.

\documentclass[oneside,12pt]{memoir}% http://ctan.org/pkg/memoir
\usepackage{geometry}% http://ctan.org/pkg/geometry
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{multicol}% http://ctan.org/pkg/multicol
\usepackage{pdflscape}% http://ctan.org/pkg/pdflscape
\begin{document}
\lipsum[1-10]% Prior stuff in your document

\newgeometry{margin=1cm,includeheadfoot}% Page break and modify layout
\begin{landscape}
\setlength{\columnseprule}{0.4pt}%
\noindent\centerline{A: Main heading - variable height} \par
\hrulefill

\begin{multicols}{2}
\null\columnbreak
\noindent\centerline{\textbf{B: Mid heading}} \par
\noindent\hskip-.5\columnsep\hrulefill

C: Mid Content (may be any height). C~can be any height
up to around \verb!5cm! (but it should only expand to that size if necessary.

\noindent\hskip-.5\columnsep\hrulefill

\centering
\parbox{6cm}{%
D: This content may be short or long, but in any case the line on the left
should go to the bottom of the page.
}

\rule{0pt}{\textheight}
\end{multicols}
\end{landscape}
\end{document}


\null "fools" TeX into thinking there something in the first column, after which a \columnbreak is issued, leaving that column blank. Alternatively, you could put whatever content in this column as needed. Rules across the second column have been shifted 0.5\columnsep to line up with the vertical \columnseprule supplied by multicol, making it seem like a tabular.

The final use of \rule{0pt}{\textheight} (an invisible/zero-width rule) ensures that the second column extends all the way to the end of the text block without producing an error/warning due to the encompassing landscape environment.

lipsum provided dummy text, while pdflscape allowed for adequate rotation of portrait pages to landscape.

-
Thanks for the answer – this is excellent, and pretty close to the sort of solution I've been thinking of. pdflscape is great; for some reason I wasn't using it, but I can't remember why now. :o) The one constraint I have (that I didn't note in the question - sorry; that's why I was using {tabularx}{...}{Xc}) is that the width of the X block should be "max(.5\linewidth, \linewidth - D)" eg X should be 70% of the width when the width of D is 30%. I'm tinkering now to see if I can figure that out. –  Brian M. Hunt Nov 10 '11 at 0:31
... I guess what I need is the height of multicol with the column sizing of tabularx. :) –  Brian M. Hunt Nov 10 '11 at 0:39

Based on Werner's answer, I did the following:

\documentclass[oneside,12pt]{memoir}

\usepackage{pdflscape}
\usepackage{geometry}% http://ctan.org/pkg/geometry

\begin{document}
\newgeometry{margin=1cm,includeheadfoot}% Page break and modify layout
\begin{landscape}

\noindent
\begin{tabularx}{\linewidth}{X|c}

\multicolumn{2}{c}{
\parbox[l][2cm][l]{2cm par box height}
} \\ \midrule%
X: (This side blank) & \textbf{B: Mid heading} \\ %
\cline{2-2} \\ [1ex]%
& C: Mid Content (may be any height) \\ [1ex] \cline{2-2} \\%
& \parbox[l][.60\textheight][l]{6cm}{D: This content may be short or long, but in any %
case the line on the left %
should go to the bottom of the page.}

\end{tabularx}
\end{landscape}
\end{document}


This is good enough for this answer for now. :) One helpful trick was \parbox[l][.60\textheight][l]{6cm}, which extended the height of the cell to .6\textheight, which should work for 99.9% of my use cases (tall enough when A is short, but doesn't wrap to a new page when A is quite high).

-