I'm trying to define a command that adds a horizontal line after text blocks, but I'm struggling to find a way to omit the line at pagebreak – the text blocks should be separated by either the horizontal line or a page break, never both.
Here's a MWE showing my approach:
\documentclass[paper=a5]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\newcommand{\mycommand}[1]{%
#1%
\vspace{.1ex}\begin{center}\rule{.25\textwidth}{0.4pt}\end{center}\vspace{.1ex}%
}
\begin{document}
\mycommand{\blindtext[2]}
\mycommand{some text some text some text some text some text some text some text}
\end{document}
Output
There's a horizontal line at the top of the second page that I want to be omitted. How can I do that?
I read Reacting to a page break in LaTeX but I didn't find a way to adapt its solution to my problem.
\leader
to work with\rule
. – dessert Dec 24 '17 at 11:50\leaders\hbox{\rule.....}
– David Carlisle Dec 24 '17 at 12:06