Understanding LaTeX 2e's @esphack
Difference between -| and |- in TikZ
Why did the EU agree to delay the Brexit deadline?
Did arcade monitors have same pixel aspect ratio as TV sets?
Can the Supreme Court overturn an impeachment?
anything or something to eat
Fuse symbol on toroidal transformer
Is it improper etiquette to ask your opponent what his/her rating is before the game?
A Permanent Norse Presence in America
Reply 'no position' while the job posting is still there
Diode in opposite direction?
Is there a conventional notation or name for the slip angle?
Does the Mind Blank spell prevent the target from being frightened?
Greco-Roman egalitarianism
Should spaces be used when writing foreign names in katakana?
Drawing ramified coverings with tikz
Extending the spectral theorem for bounded self adjoint operators to bounded normal operators
Freedom of speech and where it applies
Visiting the UK as unmarried couple
We have a love-hate relationship
Query about absorption line spectra
Do the concepts of IP address and network interface not belong to the same layer?
Two-sided logarithm inequality
Global amount of publications over time
When quoting, must I also copy hyphens used to divide words that continue on the next line?
Understanding LaTeX 2e's @esphack
I'm reading source2e.pdf and I have problems in understanding the sense of the definition of LaTeX 2ε's esphack:
Commands like label{...} , which themselves do not/shall not produce any visible output, might in the source/in the .tex-input-file be surrounded by spaces. If so, you don't want two space-tokens as this would double the horizontal glue.
If I got it right, @bsphack and @esphack are there for avoiding the coming into being of a space-token after tokenizing and processing the command in case there already came one into being before tokenizing and processing the command.
So let's look at the definition of @bsphack:
> @bsphack=macro:
->relax ifhmode @savsk lastskip @savsf spacefactor fi .
l.1 show@bsphack
In words:
When in horizontal mode or in restricted horizontal mode, then save the value of lastskip to @savsk and save the value of spacefactor to @savsf.
Now let's look at the definition of @esphack:
> @esphack=macro:
->relax ifhmode spacefactor @savsf ifdim @savsk >z@ ifdim lastskip =z
@ nobreak hskip z@skip fi ignorespaces fi fi .
l.2 show@esphack
In words:
When in horizontal mode or in restricted horizontal mode, then:
- restore the value of
spacefactorto the value saved assavsf. - In case
@savskis larger than zero, i.e., in case there was some horizontal glue before carrying out the command which at its start called@bsphack, then doifdim lastskip =z@ nobreak hskip z@skip fi ignorespaces
.
I understand that ignorespaces will make sense as there was already some horizontal glue before carrying out the command which at its start called @bsphack.
But I don't understand what theifdim lastskip =z@ nobreak hskip z@skip fi
-part is good for.
What is the sense of this?
In the situation where this is carried out, the saved value in @savsk is larger than z@, thus one can conclude that something from within the command which at its start called @bsphack did change the value of lastskip to z@.
But doing something like nobreakhskipz@skip will not revert that change/will not restore lastskip to its previous value.
Thus: What is the gist/sense/benefit of performing that hskip of zero-width?
If you wish lastskip to be restored, shouldn't it then be something like:
def@esphack{%
relax
ifhmode
spacefactor@savsf
ifdim@savsk>z@
ifdimlastskip=z@
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
fi
ignorespaces
fi
fi
}%
Or perhaps just
def@esphack{%
relax
ifhmode
spacefactor@savsf %now spacefactor is restored.
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
ifdim@savsk>z@
ignorespaces
fi
fi
}%
Is it possible that in some previous release, it was done this way and in later releases somebody erroneously "optimized" the
nobreakhskip-@savsknobreakhskip@savsk to nobreakhskipz@skip, overlooking that this won't restore lastskip any more?
If I understand correctly, you need to restore lastskip correctly as otherwise things with consecutive sequences of @bsphck..@esphack, e.g., label{foo}label{bar} won't work correctly.
spacing macros horizontal
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm reading source2e.pdf and I have problems in understanding the sense of the definition of LaTeX 2ε's esphack:
Commands like label{...} , which themselves do not/shall not produce any visible output, might in the source/in the .tex-input-file be surrounded by spaces. If so, you don't want two space-tokens as this would double the horizontal glue.
If I got it right, @bsphack and @esphack are there for avoiding the coming into being of a space-token after tokenizing and processing the command in case there already came one into being before tokenizing and processing the command.
So let's look at the definition of @bsphack:
> @bsphack=macro:
->relax ifhmode @savsk lastskip @savsf spacefactor fi .
l.1 show@bsphack
In words:
When in horizontal mode or in restricted horizontal mode, then save the value of lastskip to @savsk and save the value of spacefactor to @savsf.
Now let's look at the definition of @esphack:
> @esphack=macro:
->relax ifhmode spacefactor @savsf ifdim @savsk >z@ ifdim lastskip =z
@ nobreak hskip z@skip fi ignorespaces fi fi .
l.2 show@esphack
In words:
When in horizontal mode or in restricted horizontal mode, then:
- restore the value of
spacefactorto the value saved assavsf. - In case
@savskis larger than zero, i.e., in case there was some horizontal glue before carrying out the command which at its start called@bsphack, then doifdim lastskip =z@ nobreak hskip z@skip fi ignorespaces
.
I understand that ignorespaces will make sense as there was already some horizontal glue before carrying out the command which at its start called @bsphack.
But I don't understand what theifdim lastskip =z@ nobreak hskip z@skip fi
-part is good for.
What is the sense of this?
In the situation where this is carried out, the saved value in @savsk is larger than z@, thus one can conclude that something from within the command which at its start called @bsphack did change the value of lastskip to z@.
But doing something like nobreakhskipz@skip will not revert that change/will not restore lastskip to its previous value.
Thus: What is the gist/sense/benefit of performing that hskip of zero-width?
If you wish lastskip to be restored, shouldn't it then be something like:
def@esphack{%
relax
ifhmode
spacefactor@savsf
ifdim@savsk>z@
ifdimlastskip=z@
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
fi
ignorespaces
fi
fi
}%
Or perhaps just
def@esphack{%
relax
ifhmode
spacefactor@savsf %now spacefactor is restored.
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
ifdim@savsk>z@
ignorespaces
fi
fi
}%
Is it possible that in some previous release, it was done this way and in later releases somebody erroneously "optimized" the
nobreakhskip-@savsknobreakhskip@savsk to nobreakhskipz@skip, overlooking that this won't restore lastskip any more?
If I understand correctly, you need to restore lastskip correctly as otherwise things with consecutive sequences of @bsphck..@esphack, e.g., label{foo}label{bar} won't work correctly.
spacing macros horizontal
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm reading source2e.pdf and I have problems in understanding the sense of the definition of LaTeX 2ε's esphack:
Commands like label{...} , which themselves do not/shall not produce any visible output, might in the source/in the .tex-input-file be surrounded by spaces. If so, you don't want two space-tokens as this would double the horizontal glue.
If I got it right, @bsphack and @esphack are there for avoiding the coming into being of a space-token after tokenizing and processing the command in case there already came one into being before tokenizing and processing the command.
So let's look at the definition of @bsphack:
> @bsphack=macro:
->relax ifhmode @savsk lastskip @savsf spacefactor fi .
l.1 show@bsphack
In words:
When in horizontal mode or in restricted horizontal mode, then save the value of lastskip to @savsk and save the value of spacefactor to @savsf.
Now let's look at the definition of @esphack:
> @esphack=macro:
->relax ifhmode spacefactor @savsf ifdim @savsk >z@ ifdim lastskip =z
@ nobreak hskip z@skip fi ignorespaces fi fi .
l.2 show@esphack
In words:
When in horizontal mode or in restricted horizontal mode, then:
- restore the value of
spacefactorto the value saved assavsf. - In case
@savskis larger than zero, i.e., in case there was some horizontal glue before carrying out the command which at its start called@bsphack, then doifdim lastskip =z@ nobreak hskip z@skip fi ignorespaces
.
I understand that ignorespaces will make sense as there was already some horizontal glue before carrying out the command which at its start called @bsphack.
But I don't understand what theifdim lastskip =z@ nobreak hskip z@skip fi
-part is good for.
What is the sense of this?
In the situation where this is carried out, the saved value in @savsk is larger than z@, thus one can conclude that something from within the command which at its start called @bsphack did change the value of lastskip to z@.
But doing something like nobreakhskipz@skip will not revert that change/will not restore lastskip to its previous value.
Thus: What is the gist/sense/benefit of performing that hskip of zero-width?
If you wish lastskip to be restored, shouldn't it then be something like:
def@esphack{%
relax
ifhmode
spacefactor@savsf
ifdim@savsk>z@
ifdimlastskip=z@
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
fi
ignorespaces
fi
fi
}%
Or perhaps just
def@esphack{%
relax
ifhmode
spacefactor@savsf %now spacefactor is restored.
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
ifdim@savsk>z@
ignorespaces
fi
fi
}%
Is it possible that in some previous release, it was done this way and in later releases somebody erroneously "optimized" the
nobreakhskip-@savsknobreakhskip@savsk to nobreakhskipz@skip, overlooking that this won't restore lastskip any more?
If I understand correctly, you need to restore lastskip correctly as otherwise things with consecutive sequences of @bsphck..@esphack, e.g., label{foo}label{bar} won't work correctly.
spacing macros horizontal
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm reading source2e.pdf and I have problems in understanding the sense of the definition of LaTeX 2ε's esphack:
Commands like label{...} , which themselves do not/shall not produce any visible output, might in the source/in the .tex-input-file be surrounded by spaces. If so, you don't want two space-tokens as this would double the horizontal glue.
If I got it right, @bsphack and @esphack are there for avoiding the coming into being of a space-token after tokenizing and processing the command in case there already came one into being before tokenizing and processing the command.
So let's look at the definition of @bsphack:
> @bsphack=macro:
->relax ifhmode @savsk lastskip @savsf spacefactor fi .
l.1 show@bsphack
In words:
When in horizontal mode or in restricted horizontal mode, then save the value of lastskip to @savsk and save the value of spacefactor to @savsf.
Now let's look at the definition of @esphack:
> @esphack=macro:
->relax ifhmode spacefactor @savsf ifdim @savsk >z@ ifdim lastskip =z
@ nobreak hskip z@skip fi ignorespaces fi fi .
l.2 show@esphack
In words:
When in horizontal mode or in restricted horizontal mode, then:
- restore the value of
spacefactorto the value saved assavsf. - In case
@savskis larger than zero, i.e., in case there was some horizontal glue before carrying out the command which at its start called@bsphack, then doifdim lastskip =z@ nobreak hskip z@skip fi ignorespaces
.
I understand that ignorespaces will make sense as there was already some horizontal glue before carrying out the command which at its start called @bsphack.
But I don't understand what theifdim lastskip =z@ nobreak hskip z@skip fi
-part is good for.
What is the sense of this?
In the situation where this is carried out, the saved value in @savsk is larger than z@, thus one can conclude that something from within the command which at its start called @bsphack did change the value of lastskip to z@.
But doing something like nobreakhskipz@skip will not revert that change/will not restore lastskip to its previous value.
Thus: What is the gist/sense/benefit of performing that hskip of zero-width?
If you wish lastskip to be restored, shouldn't it then be something like:
def@esphack{%
relax
ifhmode
spacefactor@savsf
ifdim@savsk>z@
ifdimlastskip=z@
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
fi
ignorespaces
fi
fi
}%
Or perhaps just
def@esphack{%
relax
ifhmode
spacefactor@savsf %now spacefactor is restored.
nobreak
hskip-@savsk
nobreak
hskip@savsk
% the total skip is zero and lastskip is restored.
ifdim@savsk>z@
ignorespaces
fi
fi
}%
Is it possible that in some previous release, it was done this way and in later releases somebody erroneously "optimized" the
nobreakhskip-@savsknobreakhskip@savsk to nobreakhskipz@skip, overlooking that this won't restore lastskip any more?
If I understand correctly, you need to restore lastskip correctly as otherwise things with consecutive sequences of @bsphck..@esphack, e.g., label{foo}label{bar} won't work correctly.
spacing macros horizontal
spacing macros horizontal
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 mins ago
QuestionerQuestioner
1
1
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Questioner is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
0
active
oldest
votes
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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Questioner 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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481259%2funderstanding-latex-2es-esphack%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Questioner is a new contributor. Be nice, and check out our Code of Conduct.
Questioner is a new contributor. Be nice, and check out our Code of Conduct.
Questioner is a new contributor. Be nice, and check out our Code of Conduct.
Questioner is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481259%2funderstanding-latex-2es-esphack%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown