Why does adding `par` here add vertical space in a different place?
Clash 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.
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!
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
New contributor
add a comment |Â
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.
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!
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
New contributor
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.
-- thepar
won't have that effect.
â barbara beeton
1 hour ago
@barbarabeeton I actually intended to puthuge
within the same braces as thehfill
s, but I see that my formatting makes it look like I intended otherwise!
â AJFarmar
19 mins ago
add a comment |Â
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.
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!
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
New contributor
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.
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!
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
spacing paragraphs line-spacing
New contributor
New contributor
New contributor
asked 1 hour ago
AJFarmar
1284
1284
New contributor
New contributor
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.
-- thepar
won't have that effect.
â barbara beeton
1 hour ago
@barbarabeeton I actually intended to puthuge
within the same braces as thehfill
s, but I see that my formatting makes it look like I intended otherwise!
â AJFarmar
19 mins ago
add a comment |Â
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.
-- thepar
won't have that effect.
â barbara beeton
1 hour ago
@barbarabeeton I actually intended to puthuge
within the same braces as thehfill
s, 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 hfill
s, 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 hfill
s, but I see that my formatting makes it look like I intended otherwise!â AJFarmar
19 mins ago
add a comment |Â
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
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$
That's a very clever way of defining the rule! I appreciate the explanation very much.
â AJFarmar
14 mins ago
add a comment |Â
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
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$
That's a very clever way of defining the rule! I appreciate the explanation very much.
â AJFarmar
14 mins ago
add a comment |Â
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
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$
That's a very clever way of defining the rule! I appreciate the explanation very much.
â AJFarmar
14 mins ago
add a comment |Â
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
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$
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
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$
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
add a comment |Â
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
add a comment |Â
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.
AJFarmar is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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.
-- thepar
won't have that effect.â barbara beeton
1 hour ago
@barbarabeeton I actually intended to put
huge
within the same braces as thehfill
s, but I see that my formatting makes it look like I intended otherwise!â AJFarmar
19 mins ago