I defined a new command that would "clamp" text together to prevent it from breaking across a page.
I wanted to be able to switch from clamped to unclamped text with no jarring issues with line spacing, and allow myself to have to clamp globs of text next to each other (on top of one another; I don't intend to transition from one clamped block of text to another within a line) with normal line spacing.
Adjusting the spacing at first seemed to work but I realized that it only worked if the clamped paragraph was not too close to the end or beginning of a page; if the leftover page height is just too small it seems that a clamped paragraph can get pushed up or down slightly.
Here is my command and its support so far:
\newlength{\parsk}
\newlength{\parin}
\setlength{\parsk}{\parskip}
\setlength{\parin}{\parindent}
\newbox\linebox
\setbox\linebox=\hbox{gh}
\newcommand{\clasp}[1]{\noindent\begin{minipage}[b]{\textwidth}
\setlength{\parskip}{\parsk}
\setlength{\parindent}{\parin}
\vspace{1\dp\linebox}
#1
\end{minipage}}
Does anyone know how to fix this problem?
Here is a test document that shows a situation in which the problem occurs:
\documentclass{article}
\newlength{\parsk}
\newlength{\parin}
\setlength{\parsk}{\parskip}
\setlength{\parin}{\parindent}
\newbox\linebox
\setbox\linebox=\hbox{gh}
\newcommand{\clamp}[1]{\noindent\begin{minipage}[b]{\textwidth}
\setlength{\parskip}{\parsk}
\setlength{\parindent}{\parin}
\vspace{1\dp\linebox}
#1
\end{minipage}}
\newcommand{\text}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque dignissim justo eget est viverra eleifend. Fusce sed felis vulputate, tempor lacus et, iaculis nisi. Sed ultricies mi neque, ut euismod dui rhoncus id. Cras fringilla, turpis in fringilla rutrum, nulla elit porttitor tellus, eu finibus sapien turpis hendrerit odio. In malesuada metus ac justo placerat fermentum. Cras ac turpis mattis, ornare arcu lobortis, cursus nisi. Vestibulum nec cursus ante. Vivamus quis consectetur mauris.}
\begin{document}
\text
\clamp{\text}
\text
\text
\clamp{\text}
\clamp{\text}
\clamp{\text}
\end{document}