I am trying to find a way to get LaTeX to insert a different amount of vertical space depending on how much text there is in a specific environment:
For two single lines I'd like one kind of space (say \smallskip) for everything longer another one (e.g. \bigskip).
The environment is like \quote; it can be modified for the whole document but should be the same regardless of how much text it contains, i.e. I would like LaTeX to do the measuring and calculating.
I am using luaLaTeX anyway, so a solution using its specific abilities would also be very welcome.
To illustrate:
\documentclass{article}
\newcommand{\varvspacehere}{\bigskip}
\begin{document}
Long passages of normal running text ...
\begin{quote}
Sometimes a short line.
\varvspacehere %this one should automatically only be a \smallskip
Sometimes short lines
\end{quote}
Long passages of normal running text ...
\begin{quote}
Sometimes several lines. Sometimes several lines. Sometimes several lines. Sometimes several lines.
\varvspacehere
Sometimes several lines. Sometimes several lines. Sometimes several lines. Sometimes several lines. The pairs are not always of the same length.
\end{quote}
Long passages of normal running text ...
\begin{quote}
Sometimes several lines. Sometimes several lines. Sometimes several lines. Sometimes several lines.
There can also be normal par-breaks within the text portions -- they should as they usually do.
\varvspacehere
Sometimes several lines. Sometimes several lines. Sometimes several lines. Sometimes several lines. The pairs are not always of the same length.
There can also be normal par-breaks within the text portions -- they should as they usually do and (ideally) not require aditional markup.
The environments can be quite long so pagebreaks can occur within.
\end{quote}
Long passages of normal running text ...
\end{document}
If I put the whole environment into a box I could measure the width of the text but loose the paragraphs.
\par\ifnum\prevgraf>2 \bigskip \else \smallskip\fiis all you need. – David Carlisle Aug 09 '21 at 15:12