I have a memoir project where the chapters run right after each other with a divider line between chapters. If the chapter falls at the top of a page there shouldn't be a line or a space. Is there any automatic way to do this or is the best way to just use 2 chapter styles and manually switch between them to remove the line and extra space?
\documentclass[12pt,a4paper,article]{memoir}
\usepackage{lipsum}
%----------depthead
\makeatletter
\makechapterstyle{mychapter}{%
\renewcommand{\printchaptername}{}% suppress "Chapter" from heading
\renewcommand*{\printchapternum}{}% suppress numbering from heading
\renewcommand*{\chaptitlefont}{\centering}% title formatting
\renewcommand\afterchapternum{%
\vskip3em\hrulefill\vskip1em}%
\setlength\beforechapskip{-10pt}%
\setlength\afterchapskip{30pt}% adjust vertical space after the title
}
\makeatother
\chapterstyle{mychapter}
\begin{document}
\chapter{Sample Chapter 1 should not have line and space}
\lipsum[1]
\chapter{Sample Chapter 2}
\lipsum[1]
\newpage
\chapter{Sample Chapter 3 should not have line and space}
\lipsum[1]
\end{document}
\cleaders\hbox{hello world}\vskip\baselineskipinstead the\leadersconstruction. The amount of\vskipspace have to be set in order exactly one\hboxcan fit in it. If no then you get the\hboxrepeated or none\hboxis printed. You can put arbitrary graphics inside the\hbox. You can read appropriate manulas about\leaders. – wipet Aug 13 '14 at 06:26\cleaders\hbox to\hsize{\hss hello world\hss}\vskip\baselineskip– wipet Aug 13 '14 at 19:57