1

I use LaTeX2e. My question is: Can you have a command which adds vertical glue (or increases \parskip-glue) if the next thing that happens is starting new paragraph?

Something like:

\documentclass{article}

\newcommand{\AddVerticalGlueIfParagraphEndsHere}[1]{....????....}

\begin{document}

% Here nothing shall happen at all because 
% \AddVerticalGlueIfParagraphEndsHere
% is in the middle of a paragraph:

text text\AddVerticalGlueIfParagraphEndsHere{2cm} text text
text text text text text text text text

text text text text text text text text text text text text text
% Following \parskip-glue shall be increased by 2cm in comparison
% to what it usually is because 
% \AddVerticalGlueIfParagraphEndsHere
% is the last thing before starting a new paragraph:
text text text text text text text text text text text text text
text \begingroup text text\AddVerticalGlueIfParagraphEndsHere{2cm}%
\endgroup\csname @firstofone\endcsname{\emppty}\relax

text text text text text text text text text text text text text
text text text text text text text text text text text text text
text text text text text

% Here normal \parskip-glue:
text text text text text text text text text text text text text
text text text text text text text text text text text text text
text text text text text

\end{document}
  • Maybe this will help--https://tex.stackexchange.com/questions/57331/undo-last-vertical-skip/57339#57339 – js bibra Nov 25 '19 at 00:39
  • @jsbibra My issue is more about detecting if the end of the current paragraph is reached. And I can't use \everypar because that is not "group-resistent". – Jewdokija Nov 25 '19 at 01:11
  • https://tex.stackexchange.com/questions/300870/how-to-vertically-align-two-or-more-random-places-of-a-document/332719#332719 – js bibra Nov 25 '19 at 01:38
  • There is \futurlet. For example, \futurlet\a\b\par will \let\a=\par then expand \b, which can contain \ifx\par\a ... \fi. – John Kormylo Nov 25 '19 at 05:09

0 Answers0