I use LaTeX 2e. I have material for horizontal mode.
Is there an environment similar to minipage with syntax similar to
\begin{SmallestWidthAtRecommendedHeight}[⟨Outer Position⟩]{⟨Maximum Width⟩}{⟨Recommended Height⟩}[⟨Inner Position⟩]
⟨Content of the environment⟩
\end{SmallestWidthAtRecommendedHeight}
, and where line-breaking is done with the ⟨Content of the environment⟩ as described below?
Break the lines of the ⟨Content of the environment⟩ in a box of the smallest width possible without the height of that box exceeding the ⟨Recommended Height⟩. If that smallest width is larger than ⟨Maximum Width⟩, then instead break the lines of the ⟨Content of the environment⟩ in a box of width ⟨Maximum Width⟩ no matter if the height of the resulting box exceeds the ⟨Recommended Height⟩ or not.
I already looked at packages varwidth and pbox, but they both don't work the way I have in mind:
varwidth does not typeset the box at minimum-width, but typesets the box with line-wrapping at given width and then checks if the result would also fit into a box of smaller width without linebreaks/height being changed.
pbox does not let you provide a ⟨Maximum Width⟩ for the length of its lines but lets you provide a ⟨Minimum Width⟩ and typesets the box with lines wrapped as short as possible but not shorter than ⟨Minimum Width⟩.
I need: Wrap lines as short as possible at ⟨Recommended Height⟩, but without lines being longer than ⟨Maximum Width⟩. In case the width of lines at ⟨Recommended Height⟩ would exceed ⟨Maximum Width⟩, wrap lines to the length ⟨Maximum Width⟩ no matter if ⟨Recommended Height⟩ is exceeded or not.