1

I'm using this command:

\newcommand{\opitem}[1]{\item[\planop{#1} \hspace{\leftmargin} \vspace{\smallskipamount}]}

in a document of mine. I want to tweak it so as ensure I won't get a page break before the rest of the text for this item. How would I best achieve that?

5
  • A \vspace in the middle of an \item argument? what should it do there? Feb 20 '18 at 23:44
  • why don't you remove both the spaces and just set the list parameters to have the space that you want? Feb 21 '18 at 0:05
  • you have not shown the relevant code but in most latex lists the argument of \item[...] is set in horizontal mode, so using a vertical skip is somewhat strange. Feb 21 '18 at 0:08
  • 1
    Can you provide a better MWE for your requirement, ie., from `\documentclass{}...\end{document}'...
    – MadyYuvi
    Feb 21 '18 at 6:13
  • Is there any news here?
    – Johannes_B
    Feb 25 '18 at 12:02
1

There’s \nopagebreak. It works well when is placed before \vspace

This text is kept together with following equation on the same page
\nopagebreak\vspace{-.25em}
\begin{equation}
\ldots
\end{equation}

Another example. I use tocloft to tune table of contents. Without \nopagebreak inside

\renewcommand{\cftchapafterpnum}{\nopagebreak\vspace{.25em}}

I have

without nopagebreak

which looks silly, chapter is on this page but its sections are on the next one. But \nopagebreak refines the layout

with nopagebreak

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.