I have several tables in my document that are just a bit too small to fill the entire page, vertically.
I'd like to stretch the table, either by adding empty lines at the bottom, or by stretching the lineskip, so that the table fills the text area.
How would I go about this?
\documentclass{scrbook} % because that is what I use
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabularx}
\usepackage{showframe}
\usepackage{lipsum}
\begin{document}
\begin{table*}
\begin{tabularx}{\linewidth}{|X|X|}
\hline
\textbf{Column A} & \textbf{Column B}\\
\hline
\lipsum[1] & \lipsum[2] \\
\hline
\end{tabularx}
\end{table*}
\end{document}
I want the red-marked whitespace to disappear, i.e. the table borders to match the textarea borders.
Note that this is contrived. In the real document, this is about sidewaystable
– making the non-textarea height much more disruptive for the overall layout, and removing the option of simply having surrounding text take up the whitespace.
Best Answer
A solution, where the caption is put inside the tables (example tables taken from the answers of David Carlisle and DevSolar):
Remarks:
The horizontal position inside
\noalign
is the left border of the tabular. Because the width of the tabular is not known here, a proper centering is only possible, if the table spans the full width.KOMA-Script option
captions=tableheadings
added to get the correct spacing for the table captions.Inside
sidewaystable*
\captionabove
is used, because KOMA-Script fails to see that this is also a table.