Avoid page break between paragraphs with \medskip in between
Avoid using explicit font change commands.
if you use a section heading command the markup is more flexible and LaTeX automatically takes care of not allowing a page break after the heading
\documentclass{report}
\begin{document}
Some text
\vspace{40\baselineskip}% heading and text stay on this page
%\vspace{41\baselineskip}% heading and text go to next page
Some text
\subsection*{Mini title}
Some more text
\end{document}
I copied the \medbreak
command from LaTeX and made a \mednobreak
. It does a \nopagebreak
and a \medskip
. It will attach the first line of the following paragraph to the \textbf{Mini title}
. Comment the line marked to see the effect.
\documentclass{report}
\usepackage{lipsum}
\def\mednobreak{\par\ifdim\lastskip<\medskipamount
\removelastskip\nopagebreak\medskip\fi}
\begin{document}
\lipsum[1-4]
\lipsum[2]
another line % comment to see difference
\medskip
\textbf{Mini title}
\mednobreak
\lipsum[1]
\end{document}
I suggest you load the needspace
package and issue the directive
\Needspace*{3\baselineskip}
immediately before the first \medskip
directive.
A full MWE (minimum working example):
\documentclass{report}
\usepackage{needspace}
\begin{document}
\dots
Some text
\Needspace*{3\baselineskip}
\medskip
\textbf{Mini title}
\medskip
Some more text
\end{document}