# \hrulefill, just vertically

The command \hrulefill fills the rest of the line with a rule. Now, I would like to create a vertical line to the bottom of the page, starting from the last paragraph on that page. Is this possible?

I need the line on the left side, but I am also interested to understand how this can be achieved conceptually, as (to my knowledge) there is no way to know where you are at a certain moment during rendering.

• Along the left margin? The right margin? From the end-point of the paragraph? – Werner Mar 1 '16 at 18:28
• – Alenanno Mar 1 '16 at 19:05
• It could be remarked that pdfTeX does have primitives (\pdfsavepos/\pdflastxpos/pdflastypos) that record, at \shipout-time, where a given point is eventually placed on the page (or rendering canvas), and allow you to subsequently retrieve the saved position so that it can, e.g., be saved into an auxiliary file and used in the next run. – GuM Mar 1 '16 at 22:40

The command \hrulefill doesn't know where it is issued from; it just fills the remaining space on the line in a similar way to what \hfill does (actually it is the same way).

For \vrulefill it's quite similar:

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\lipsum[1]
\vrulefill

\clearpage % <-- not necessary if it's the last page

\end{document}


You can make the rule start from where the last paragraph ends by finishing the paragraph with \parvrulefill as in these examples:

\documentclass{article}
\usepackage{lipsum}

\makeatletter
\newcommand{\parvrulefill}{%
{\abovedisplayskip=\z@\belowdisplayskip=\z@
\abovedisplayshortskip=\z@\belowdisplayshortskip=\z@
$$\xdef\vrule@shift{\the\predisplaysize}$$}%
\par
\kern-\baselineskip
\clearpage
}
\makeatother

\begin{document}

\lipsum*[1]\parvrulefill

\lipsum*[2]\parvrulefill

\end{document}


• but it would look so much nicer down the centre:-) – David Carlisle Mar 1 '16 at 19:09
• … With the usual caveat as to the use of \predisplaysize. For instance, if the document were being typeset with a non-zero \lastlinefit, we would get a bitter surprise. – GuM Mar 1 '16 at 21:29
• @GustavoMezzetti Who's using \lastlinefit? ;-) – egreg Mar 1 '16 at 21:39
• The same ones that might use, for example, \parfillskip = 0pt plus 1000pt ;-) – GuM Mar 1 '16 at 21:41

For a line down the centre you can use

\documentclass{article}

\begin{document}

aaa aaa\\bb bbbb


• And aren't you setting a bad example with \\ in body text? – musarithmia Mar 1 '16 at 19:27
• @AndrewCashner \leaders\hbox to \hsize{\hss\vrule height 1pt \hss}\vfill} – David Carlisle Mar 1 '16 at 19:57