I have a manual list of stuff that are sometimes separated by an hrule(or my own custom ruler) for visual purposes.
Sometimes the hrule ends at the top or bottom of a page which makes it useless.
Is there a way to prevent it from being added if it is at the top or bottom of a page?
MWE of problem:
\documentclass{book}
\usepackage{tikz}
\begin{document}
\newcommand\rulesep{%
\par % make sure we end a paragraph
\vskip5pt % space above the rule
\leaders\vrule width \textwidth\vskip0.4pt % rule thickness is 0.4pt
\nointerlineskip % disable interline glue here
\vskip5pt % space below the rule
}
\def\dotikzcircle#1{\begin{tikzpicture}\draw(0,0)circle(#1);\end{tikzpicture}}
\rulesep
\noindent This is a test\noindent
\rulesep
\noindent End of test
\rulesep
\dotikzcircle3
\rulesep
\begin{center}\dotikzcircle3\end{center}
\rulesep
\begin{center}\dotikzcircle3\end{center}
\rulesep
\dotikzcircle1
\rulesep
\dotikzcircle2
\rulesep
\dotikzcircle3
\rulesep
\dotikzcircle4
\rulesep
\dotikzcircle5
\rulesep
\end{document}
\rulesep
command: there's no way to remove glue if there is no following page.