0

I have a page that has a table at the top and a shaded box at the bottom. How to get the shaded box to align with the bottom of the page frame? I've tried \vfill, but that doesn't seem to work. My code is as follows:

\documentclass[10pt]{book}
\usepackage[showframe]{geometry}
\usepackage{framed}
\usepackage{blindtext}
\usepackage{tabularx}
\usepackage[x11names,table]{xcolor}
\colorlet{shadecolor}{LavenderBlush2}
\begin{document}
\begin{table}[t!]
\caption{Hello World!}
\begin{tabularx}{\columnwidth}{|c|X|c|}\hline
    A & B & C \\\hline
    D & E & F \\\hline
    G & H & I \\\hline
    J & K & L \\\hline
    M & N & O \\\hline
    P & Q & R \\\hline
    S & T & U \\\hline
    V & W & X \\\hline
    Y & Z &   \\\hline
\end{tabularx}
\end{table}
\par
\vfill
\begin{shaded*}
\noindent\blindtext\par
\blindtext\par
\blindtext
\end{shaded*}
\end{document}

This currently produces the following output: enter image description here

Edit: It has been suggested that I use \vspace*{\fill} instead. That does lower the box, but it still doesn't quite align with the page frame. enter image description here

1 Answers1

1

From difference between \vspace{\fill} and \vfill

  • \vspace{\fill} in a paragraph will add the filling vertical space below the line in which it eventually appears;

  • \vfill ends the paragraph at the spot and adds the filling vertical space.

You can use \vspace{\fill} or \ \vfill . The latter starts a paragraph with a (empty) space.

a

Set \OuterFrameSep= 0pt to remove the vertical space before and after the framed environment. It defaults to \topsep.

\documentclass[10pt]{book}
\usepackage[showframe]{geometry}
\usepackage{framed}
\usepackage{blindtext}
\usepackage{tabularx}
\usepackage[x11names,table]{xcolor}
\colorlet{shadecolor}{LavenderBlush2}
\begin{document}
    \begin{table}[t!]
        \caption{Hello World!}
        \begin{tabularx}{\columnwidth}{|c|X|c|}\hline
            A & B & C \\\hline
            D & E & F \\\hline
            G & H & I \\\hline
            J & K & L \\\hline
            M & N & O \\\hline
            P & Q & R \\\hline
            S & T & U \\\hline
            V & W & X \\\hline
            Y & Z &   \\\hline
        \end{tabularx}
    \end{table}
%% \ \vfill
\vspace*{\fill}% added <<<<<<<<<<<
\setlength{\OuterFrameSep}{0pt}% added <<<<<<<<<<<
    \begin{shaded*}
        \noindent\blindtext\par
        \blindtext\par
        \blindtext
    \end{shaded*}
\end{document}
Simon Dispa
  • 39,141