# Remove/hide content if it would appear as an orphan [duplicate]

Possible Duplicate:
prevent “action” if top of page

I have some blocks of text, separated by a \hline. Because the LaTeX code is generated automatically from user-entered data, sometimes the \hline appears last on the page, and sometimes it appears first.

Since the \hline is only used to provide a clear division between blocks, it's not needed last or first on the page, since the page break itself provides the division. Is it possible to hide/ignore/delete the \hline if it would be the first or last element on the page?

Here is some example code to illustrate the issue:

\vspace{20cm} % Adjust as necessary
\parbox[t]{3cm}{Example:}\parbox[t]{15cm}{This is an example}
\hline
\parbox[t]{3cm}{Example:}\parbox[t]{15cm}{This is an example}
\hline
\parbox[t]{3cm}{Example:}\parbox[t]{15cm}{This is an example}

-

## marked as duplicate by egreg, diabonas, Marco Daniel, Claudio Fiandrino, doncherrySep 19 '12 at 18:25

Using \leaders you can define a rule that will "disappear" at the beginning of a page:

\documentclass{article}
\usepackage[paperheight=7cm,textwidth=18cm]{geometry}% just for the example

\newcommand\Myrule{%
}

\begin{document}