I have generated a customized section heading style as follows:

\newcommand\ueber[1]{\vspace{0.2cm}\normalsize\itshape #1 \vspace{0.05cm}\normalfont}


So far, it works fine. However, I don't know how I can add "glue", so that the heading doesn't ever get separated from the subsequent paragraph when it appears at the end of a page. How can I add glue?

• Welcome to TeX SX! Yu should take a look at the titlesec documentation, in particular, you might be inerested in the nobottomtitles option (§ 3.3 Spacing related tools). Sep 4 '18 at 13:09
• glue is tex word for space so you have added that already you want a penalty so #1\par\nopagebreak\vspace{0.05cm}\normalfont although using a latex heading would be better. Sep 4 '18 at 13:16

glue is tex word for space so you have added that already you want a penalty so #1\par\nopagebreak\vspace{0.05cm}\normalfont although using a latex heading would be better.
\newcommand\ueber[1]{%