I've been playing around with LaTeX trying to really learn how spacing works in-depth. Here's a silly bit of code that I've been experimenting with:
\documentclass[]{article}
% Draw a raised \hrulefill
\newcommand{\hmidrule}[1]
{\leavevmode \leaders
\hbox{\rule[#1]{1pt}{.4pt}}
\hfill \kern0pt }
% Draw a divider with a given ornament in the middle
\newcommand\divider[2][0.33em]
{\par\noindent\hmidrule{#1}{#2}\hmidrule{#1}\par}
\begin{document}
\divider{\large\ A\ }
%%
{\hspace*{\fill}
\huge {This is the First and Last Line.}
\hspace*{\fill}} % <--- Keep this line in mind!
%%
\divider{\large\ $\Omega$\ }
\end{document}
This produces exactly the result I'd expect from this: minimal spacing on the top and bottom of the centered text.
Then I put \par
on this line:
% ...
\huge {This is the First and Last Line.}
\hspace*{\fill}\par} % <--- Added `\par` here.
%%
% ...
And I expected that no change would occur, since ending this paragraph would cause nothing; the paragraph was already ending there, but I also thought that it could feasibly add some vertical space below the centered text.
However, this was the result: vertical space before the centered text!
I really don't understand why this is happening. Why would adding this command after the text cause spacing before it? Could it be that LaTeX trying to format this as paragraphed text? If so, why didn't it add space there before I added \par
?
Any other feedback would be greatly appreciated.
I'm compiling my code on Overleaf, with pdfLaTeX. The same result occurs with XeTeX.
\huge
is a command that takes no argument. it you place it within the scope of the braces --{\huge This is the First and Last Line.}
-- the\par
won't have that effect.\huge
within the same braces as the\hfill
s, but I see that my formatting makes it look like I intended otherwise!