Why does adding `par` here add vertical space in a different place?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite












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:



documentclassarticle

% Draw a raised hrulefill
newcommandhmidrule[1]
leavevmode leaders
hboxrule[#1]1pt.4pt
hfill kern0pt

% Draw a divider with a given ornament in the middle
newcommanddivider[2][0.33em]
parnoindenthmidrule#1#2hmidrule#1par

begindocument
dividerlarge A
%%
hspace*fill
huge This is the First and Last Line.
hspace*fill % <--- Keep this line in mind!
%%
dividerlarge $Omega$
enddocument


This produces exactly the result I'd expect from this: minimal spacing on the top and bottom of the centered text.



The output of the first file



Then I put par on this line:



% ...
huge This is the First and Last Line.
hspace*fillpar} % <--- 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!



The unexpected output of the second file



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.










share|improve this question







New contributor




AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 3




    welcome to tex.sx. i'm sure this (or something like it) has been asked before, so this is just a comment. 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.
    – barbara beeton
    1 hour ago










  • @barbarabeeton I actually intended to put huge within the same braces as the hfills, but I see that my formatting makes it look like I intended otherwise!
    – AJFarmar
    19 mins ago















up vote
5
down vote

favorite












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:



documentclassarticle

% Draw a raised hrulefill
newcommandhmidrule[1]
leavevmode leaders
hboxrule[#1]1pt.4pt
hfill kern0pt

% Draw a divider with a given ornament in the middle
newcommanddivider[2][0.33em]
parnoindenthmidrule#1#2hmidrule#1par

begindocument
dividerlarge A
%%
hspace*fill
huge This is the First and Last Line.
hspace*fill % <--- Keep this line in mind!
%%
dividerlarge $Omega$
enddocument


This produces exactly the result I'd expect from this: minimal spacing on the top and bottom of the centered text.



The output of the first file



Then I put par on this line:



% ...
huge This is the First and Last Line.
hspace*fillpar} % <--- 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!



The unexpected output of the second file



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.










share|improve this question







New contributor




AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 3




    welcome to tex.sx. i'm sure this (or something like it) has been asked before, so this is just a comment. 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.
    – barbara beeton
    1 hour ago










  • @barbarabeeton I actually intended to put huge within the same braces as the hfills, but I see that my formatting makes it look like I intended otherwise!
    – AJFarmar
    19 mins ago













up vote
5
down vote

favorite









up vote
5
down vote

favorite











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:



documentclassarticle

% Draw a raised hrulefill
newcommandhmidrule[1]
leavevmode leaders
hboxrule[#1]1pt.4pt
hfill kern0pt

% Draw a divider with a given ornament in the middle
newcommanddivider[2][0.33em]
parnoindenthmidrule#1#2hmidrule#1par

begindocument
dividerlarge A
%%
hspace*fill
huge This is the First and Last Line.
hspace*fill % <--- Keep this line in mind!
%%
dividerlarge $Omega$
enddocument


This produces exactly the result I'd expect from this: minimal spacing on the top and bottom of the centered text.



The output of the first file



Then I put par on this line:



% ...
huge This is the First and Last Line.
hspace*fillpar} % <--- 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!



The unexpected output of the second file



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.










share|improve this question







New contributor




AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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:



documentclassarticle

% Draw a raised hrulefill
newcommandhmidrule[1]
leavevmode leaders
hboxrule[#1]1pt.4pt
hfill kern0pt

% Draw a divider with a given ornament in the middle
newcommanddivider[2][0.33em]
parnoindenthmidrule#1#2hmidrule#1par

begindocument
dividerlarge A
%%
hspace*fill
huge This is the First and Last Line.
hspace*fill % <--- Keep this line in mind!
%%
dividerlarge $Omega$
enddocument


This produces exactly the result I'd expect from this: minimal spacing on the top and bottom of the centered text.



The output of the first file



Then I put par on this line:



% ...
huge This is the First and Last Line.
hspace*fillpar} % <--- 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!



The unexpected output of the second file



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.







spacing paragraphs line-spacing






share|improve this question







New contributor




AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









AJFarmar

1284




1284




New contributor




AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






AJFarmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 3




    welcome to tex.sx. i'm sure this (or something like it) has been asked before, so this is just a comment. 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.
    – barbara beeton
    1 hour ago










  • @barbarabeeton I actually intended to put huge within the same braces as the hfills, but I see that my formatting makes it look like I intended otherwise!
    – AJFarmar
    19 mins ago













  • 3




    welcome to tex.sx. i'm sure this (or something like it) has been asked before, so this is just a comment. 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.
    – barbara beeton
    1 hour ago










  • @barbarabeeton I actually intended to put huge within the same braces as the hfills, but I see that my formatting makes it look like I intended otherwise!
    – AJFarmar
    19 mins ago








3




3




welcome to tex.sx. i'm sure this (or something like it) has been asked before, so this is just a comment. 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.
– barbara beeton
1 hour ago




welcome to tex.sx. i'm sure this (or something like it) has been asked before, so this is just a comment. 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.
– barbara beeton
1 hour ago












@barbarabeeton I actually intended to put huge within the same braces as the hfills, but I see that my formatting makes it look like I intended otherwise!
– AJFarmar
19 mins ago





@barbarabeeton I actually intended to put huge within the same braces as the hfills, but I see that my formatting makes it look like I intended otherwise!
– AJFarmar
19 mins ago











1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










The difference is that with par the paragraph is set with the baselineskip relative to huge, whereas it isn't without it.



If you want to control precisely the spacing between the decorated rules and the title, the best is to disable the interline spacing at the transition, with nointerlineskip.



I provided a different definition of divider that avoids the need to guess a dimension.



documentclassarticle

% Draw a divider with a given ornament in the middle
newlengthdividerht
newcommandhmidrule%
leadershrule
height dimexpr0.5dividerht+0.2pt
depth dimexpr-0.5dividerht+0.2pt
hfillkern0pt

newcommanddivider[1]%
parnoindent
settoheightdividerht#1%
parnoindenthmidrule#1hmidrulepar


begindocument

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First and Last Line.par
nointerlineskipvspace6pt
dividerlarge $Omega$

bigskip

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
nointerlineskipvspace6pt
dividerlarge $Omega$

enddocument


enter image description here



If you want that the bottom rule is spaced with respect to the baseline of the bottom line in the title, you need to remove the depth:



dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
vspace-prevdepthnointerlineskipvspace6pt
dividerlarge $Omega$


enter image description here






share|improve this answer




















  • That's a very clever way of defining the rule! I appreciate the explanation very much.
    – AJFarmar
    14 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






AJFarmar is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454667%2fwhy-does-adding-par-here-add-vertical-space-in-a-different-place%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










The difference is that with par the paragraph is set with the baselineskip relative to huge, whereas it isn't without it.



If you want to control precisely the spacing between the decorated rules and the title, the best is to disable the interline spacing at the transition, with nointerlineskip.



I provided a different definition of divider that avoids the need to guess a dimension.



documentclassarticle

% Draw a divider with a given ornament in the middle
newlengthdividerht
newcommandhmidrule%
leadershrule
height dimexpr0.5dividerht+0.2pt
depth dimexpr-0.5dividerht+0.2pt
hfillkern0pt

newcommanddivider[1]%
parnoindent
settoheightdividerht#1%
parnoindenthmidrule#1hmidrulepar


begindocument

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First and Last Line.par
nointerlineskipvspace6pt
dividerlarge $Omega$

bigskip

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
nointerlineskipvspace6pt
dividerlarge $Omega$

enddocument


enter image description here



If you want that the bottom rule is spaced with respect to the baseline of the bottom line in the title, you need to remove the depth:



dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
vspace-prevdepthnointerlineskipvspace6pt
dividerlarge $Omega$


enter image description here






share|improve this answer




















  • That's a very clever way of defining the rule! I appreciate the explanation very much.
    – AJFarmar
    14 mins ago














up vote
4
down vote



accepted










The difference is that with par the paragraph is set with the baselineskip relative to huge, whereas it isn't without it.



If you want to control precisely the spacing between the decorated rules and the title, the best is to disable the interline spacing at the transition, with nointerlineskip.



I provided a different definition of divider that avoids the need to guess a dimension.



documentclassarticle

% Draw a divider with a given ornament in the middle
newlengthdividerht
newcommandhmidrule%
leadershrule
height dimexpr0.5dividerht+0.2pt
depth dimexpr-0.5dividerht+0.2pt
hfillkern0pt

newcommanddivider[1]%
parnoindent
settoheightdividerht#1%
parnoindenthmidrule#1hmidrulepar


begindocument

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First and Last Line.par
nointerlineskipvspace6pt
dividerlarge $Omega$

bigskip

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
nointerlineskipvspace6pt
dividerlarge $Omega$

enddocument


enter image description here



If you want that the bottom rule is spaced with respect to the baseline of the bottom line in the title, you need to remove the depth:



dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
vspace-prevdepthnointerlineskipvspace6pt
dividerlarge $Omega$


enter image description here






share|improve this answer




















  • That's a very clever way of defining the rule! I appreciate the explanation very much.
    – AJFarmar
    14 mins ago












up vote
4
down vote



accepted







up vote
4
down vote



accepted






The difference is that with par the paragraph is set with the baselineskip relative to huge, whereas it isn't without it.



If you want to control precisely the spacing between the decorated rules and the title, the best is to disable the interline spacing at the transition, with nointerlineskip.



I provided a different definition of divider that avoids the need to guess a dimension.



documentclassarticle

% Draw a divider with a given ornament in the middle
newlengthdividerht
newcommandhmidrule%
leadershrule
height dimexpr0.5dividerht+0.2pt
depth dimexpr-0.5dividerht+0.2pt
hfillkern0pt

newcommanddivider[1]%
parnoindent
settoheightdividerht#1%
parnoindenthmidrule#1hmidrulepar


begindocument

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First and Last Line.par
nointerlineskipvspace6pt
dividerlarge $Omega$

bigskip

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
nointerlineskipvspace6pt
dividerlarge $Omega$

enddocument


enter image description here



If you want that the bottom rule is spaced with respect to the baseline of the bottom line in the title, you need to remove the depth:



dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
vspace-prevdepthnointerlineskipvspace6pt
dividerlarge $Omega$


enter image description here






share|improve this answer












The difference is that with par the paragraph is set with the baselineskip relative to huge, whereas it isn't without it.



If you want to control precisely the spacing between the decorated rules and the title, the best is to disable the interline spacing at the transition, with nointerlineskip.



I provided a different definition of divider that avoids the need to guess a dimension.



documentclassarticle

% Draw a divider with a given ornament in the middle
newlengthdividerht
newcommandhmidrule%
leadershrule
height dimexpr0.5dividerht+0.2pt
depth dimexpr-0.5dividerht+0.2pt
hfillkern0pt

newcommanddivider[1]%
parnoindent
settoheightdividerht#1%
parnoindenthmidrule#1hmidrulepar


begindocument

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First and Last Line.par
nointerlineskipvspace6pt
dividerlarge $Omega$

bigskip

dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
nointerlineskipvspace6pt
dividerlarge $Omega$

enddocument


enter image description here



If you want that the bottom rule is spaced with respect to the baseline of the bottom line in the title, you need to remove the depth:



dividerlarge Anointerlineskipvspace6pt
centeringhuge This is the First line and this title is so long that
it splits across lines.par
vspace-prevdepthnointerlineskipvspace6pt
dividerlarge $Omega$


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 39 mins ago









egreg

688k8518323080




688k8518323080











  • That's a very clever way of defining the rule! I appreciate the explanation very much.
    – AJFarmar
    14 mins ago
















  • That's a very clever way of defining the rule! I appreciate the explanation very much.
    – AJFarmar
    14 mins ago















That's a very clever way of defining the rule! I appreciate the explanation very much.
– AJFarmar
14 mins ago




That's a very clever way of defining the rule! I appreciate the explanation very much.
– AJFarmar
14 mins ago










AJFarmar is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















AJFarmar is a new contributor. Be nice, and check out our Code of Conduct.












AJFarmar is a new contributor. Be nice, and check out our Code of Conduct.











AJFarmar is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454667%2fwhy-does-adding-par-here-add-vertical-space-in-a-different-place%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery