I commonly run into issues with controlling the exact amount of space between two environments.
Recently, for example, I was trying to understand how to insert a horizontal rule between two boxes without adding extraneous space. The following example does what I want:
\documentclass{article}
\parindent=0pt
\begin{document}
BEFORE 1\\BEFORE 2
\hrule
AFTER 1\\AFTER 2
\end{document}
I wanted to replicate this with \hrulefill instead, to customize the width of the rule and add additional elements on the rule's line, but this does not work (the \offinterlineskip setting applies to too much):
\documentclass{article}
\parindent=0pt
\begin{document}
\offinterlineskip
BEFORE 1\\BEFORE 2\par
\hrulefill\par
AFTER 1\\AFTER 2\par
\end{document}
On the other hand, the following works, without having to change \parskip, \lineskip, or any other parameter:
\documentclass{article}
\parindent=0pt
\begin{document}
BEFORE 1\\BEFORE 2\hrule height 0pt
\hrulefill\hrule height 0pt
AFTER 1\\AFTER 2
\end{document}
What role does \hrule height 0pt play here, exactly? How does it compare to \par, and what would be the equivalent sequence of commands using \par to generate the example below? (In other words, how would one emulate \hrule using \hrulefill and \par?)



\hrulefill, and I'd like to understand there's anything wrong with the (seemingly) more robust\hrule height=0pt– Clément Aug 04 '21 at 06:18\baselineskipapart, but if the calculated\vskipis less than\lineskiplimitit uses\lineskipinstead.\hruleignores all that. – John Kormylo Aug 04 '21 at 15:40