2

On the final page of a two-column portion of a text that uses multicol, I want to put a one-column notice at the bottom of the page, and I'd like the rule separating the columns to extend all the way until just above the one-column portion. Using vfill outside multicols puts the notice in the right place but the rule only extends as far as the actual multi-column text. Using vfill inside multicols has no effect.

I'd like it to produce something like the following, but obviously without the manual \vspace* command:

\documentclass{article}
\usepackage{multicol}
\usepackage{lipsum}
\setlength{\columnsep}{0.5in}
\setlength{\columnseprule}{0.5pt}
\begin{document}

\begin{multicols}{2}
    \lipsum[1]
    \columnbreak
    \lipsum[2]
    \vspace*{300pt}
\end{multicols}
\centering\Huge\textbf{\textsf{STOP}}

\end{document}

In some respects, this is the opposite problem of the Same page and multicols question, in that I need to ensure that something which comes after the multicols environment is kept on the same page.

3
  • See also tex.stackexchange.com/questions/356306/… Commented Apr 24, 2017 at 2:12
  • That's the general idea, but I'd prefer to do that in a regular multicol environment, as I normally want to balance the columns, even if the MWE implies otherwise.
    – Karl Hagen
    Commented Apr 24, 2017 at 2:23
  • Yes, but even with multicols*, these solutions don't work when the environment goes over a single page.
    – Karl Hagen
    Commented Apr 24, 2017 at 2:31

2 Answers 2

2

You can insert the vertical rule on the last page using eso-pic:

enter image description here

\documentclass{article}

\usepackage{multicol,eso-pic,lipsum,xcolor}

\setlength{\columnsep}{0.5in}
\setlength{\columnseprule}{0.5pt}

\begin{document}

\begin{multicols}{2}
  \sloppy\lipsum[1-15]
\end{multicols}

\AddToShipoutPictureFG*{%
  \AtTextLowerLeft{%
    \makebox[0pt][l]{\makebox[\textwidth]{\Huge\bfseries\sffamily STOP}}% Set STOP
    % Move to the right of the left text column
    \hspace*{.5\dimexpr\textwidth-\columnseprule-2\columnsep}%
    % Skip over column sep
    \hspace*{\columnsep}%
    % Insert vertical rule
    \rule[3\baselineskip]{\columnseprule}{\dimexpr\textheight-3\baselineskip}%
  }%
}

\end{document}

The above example overlays a \rule on the final page 3\baselineskip from the bottom of the text block overtop of whatever is on the final page.

You could add this to \AtEndDocument. However, there is no testing done to see whether STOP will fit on the page or not, and not overlay with the existing text in the columns.


The following example sets the STOP content inside a box (called \stopbox) and uses this box as a measure of how far the vertical rule should go down to on the last page (+ one \baselineskip):

enter image description here

\documentclass{article}

\usepackage{multicol,eso-pic,lipsum,xcolor}

\setlength{\columnsep}{0.5in}
\setlength{\columnseprule}{0.5pt}

\newsavebox{\stopbox}
\savebox{\stopbox}{%
  \begin{tabular}[b]{c}
    \Huge\bfseries\sffamily STOP \\
    \small\itshape \ldots right here
  \end{tabular}
}

\begin{document}

\begin{multicols}{2}
  \sloppy\lipsum[1-15]
\end{multicols}

\AddToShipoutPictureFG*{%
  \AtTextLowerLeft{%
    \makebox[0pt][l]{\makebox[\textwidth]{\usebox{\stopbox}}}% Set STOP
    % Move to the right of the left text column
    \hspace*{.5\dimexpr\textwidth-\columnseprule-2\columnsep}%
    % Skip over column sep
    \hspace*{\columnsep}%
    % Insert vertical rule
    \rule[\dimexpr\ht\stopbox+\baselineskip]{\columnseprule}{\dimexpr\textheight-\ht\stopbox-\baselineskip}%
  }%
}

\end{document}
5
  • That does exactly what the MWE requested, so I'm inclined to accept this answer, but in my actual document, the "STOP" text can actually be multi-line. It has a fixed height for an individual document, so it can be precalculated, but depending on the specific document, the text can vary, so I can't hard-code a particular multiple of baseline skip. I'm not sure if I should start a new question for that point or extend this one.
    – Karl Hagen
    Commented Apr 24, 2017 at 3:11
  • @KarlHagen: By "the text can vary", are you referring to the STOP phrase, or the actual document text?
    – Werner
    Commented Apr 24, 2017 at 4:31
  • I meant the STOP phrase.
    – Karl Hagen
    Commented Apr 24, 2017 at 10:56
  • @KarlHagen: That's fine. One can define the STOP phrase in the preamble (by placing it inside a box, which makes it measurable) and use that to identify the spacing at the end of the text. I'll update my answer to provide such an option.
    – Werner
    Commented Apr 24, 2017 at 16:14
  • @KarlHagen: See the updated answer.
    – Werner
    Commented Apr 26, 2017 at 0:33
2

The new package multicolrule (version 1.1) can handle this problem without the need for eso-pic. While Werner's solution was perfectly serviceable for the problem as set out in the MWE, in production documents it required complicated bookkeeping to deal with situations such as having one-column material above the multicols environment, and the original and redrawn rules were slightly misaligned, requiring me to erase the old line before redrawing it. With the new package, these issues don't arise.

\documentclass{article}
\usepackage{multicolrule}
\usepackage{lipsum}
\setlength{\columnsep}{0.5in}

\newsavebox{\stopbox}
\savebox{\stopbox}{%
  \begin{tabular}[b]{c}
    \Huge\bfseries\sffamily STOP \\
    \small\itshape \ldots right here
  \end{tabular}
}

\SetMCRule{width=0.5pt,line-style=solid,extend-fill,extend-reserve=\ht\stopbox}

\begin{document}
\lipsum[1]

\begin{multicols}{2}
  \lipsum[2-3]
\end{multicols}
\centering\usebox{\stopbox}  
\end{document}

And the result:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .