herries-press icon indicating copy to clipboard operation
herries-press copied to clipboard

\needspace and \Needspace need to hide their actions better!

Open FrankMittelbach opened this issue 7 years ago • 0 comments

The suggestion in #10 is not sufficient. \needspace needs to work like \addpenalty / \addvspace, that is inspect a previous vertical skip, back up, does its work and then readd the space that was backed up so that a following \addvspace can interact with the space.

It is debatable if after backing up one needs to enlarge the requested space.

MWE showing the problem:

\documentclass{article}

\usepackage{needspace}


\begin{document}

\section{no needspace}

\begin{itemize}
\item x  \item x  \item x  \item x
\end{itemize}


\begin{itemize}
\item y  \item y  \item y  \item y
\end{itemize}

\newpage

\section{with needspace}

\begin{itemize}
\item x  \item x  \item x  \item x
\end{itemize}

\needspace{1cm}

\begin{itemize}
\item y  \item y  \item y  \item y
\end{itemize}


\newpage

\section{with Needspace}

\begin{itemize}
\item x  \item x  \item x  \item x
\end{itemize}

\Needspace{1cm}

\begin{itemize}
\item y  \item y  \item y  \item y
\end{itemize}

\end{document}

Result:

test-needspace.pdf

FrankMittelbach avatar Dec 05 '18 10:12 FrankMittelbach