What is an internal dimension/glue/muglue?Difference between one glue and two glues after each...
Why did Gandalf use a sword against the Balrog?
Understanding the point of a kölsche Witz
If clocks themselves are based on light signals, wouldn't we expect the measured speed of light to always be the same constant?
Do I have to cite common CS algorithms?
Is this n-speak?
Is there a SQL/english like language that lets you define formulations given some data?
Is it legal for a company to enter an agreement not to hire employees from another company?
How does proof assistant organize knowledge?
How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?
A continuous water "planet" ring around a star
If a digital camera can be "hacked" in the ransomware sense, how best to protect it?
What is my malfunctioning AI harvesting from humans?
Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?
Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?
On the Rømer experiments and the speed of light
Are employers legally allowed to pay employees in goods and services equal to or greater than the minimum wage?
Are differences between uniformly distributed numbers uniformly distributed?
What is this 1990s horror game of otherworldly PCs dealing with monsters on modern Earth?
Can "être sur" mean "to be about" ?
Bitcoin successfully deducted on sender wallet but did not reach receiver wallet
How can this older-style irrigation tee be replaced?
Can sampling rate be a floating point number?
Is there a standardised way to check fake news?
Is 悪いところを見つかった proper Japanese?
What is an internal dimension/glue/muglue?
Difference between one glue and two glues after each otherDifference between unrestricted and internal vertical modeMeasure total glue in a boxScaling a glue in TeXbadness for lines without glue?Question about vertical glue (concerning example from TeXbook)When does TeX choose to stretch the glue?How to access the glue?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
In the documentation of l3skip
's dim_eval:n
one is warned
This [...] requires suitable termination if used in a TeX-style assignment as it is not an ⟨internal dimension⟩.
Analogous warnings can be found in the descriptions for skip_eval:n
and muskip_eval:n
with ⟨internal glue⟩ and ⟨internal muglue⟩ in place of ⟨internal dimension⟩.
I am fairly familiar with handling skips and dimensions in TeX, but I have never before come across the expression internal dimension. In the TeXbook I could not find any explanation of the phrase outside of the rather technical grammar notation in chapter 24, which surely contains all the necessary information but did not really help me.
So, what exactly is an internal dimension? What are other types of dimensions? (External dimensions?) What are examples of different behavior of the two (like the one alluded to by the warning above)?
tex-core syntax
add a comment |
In the documentation of l3skip
's dim_eval:n
one is warned
This [...] requires suitable termination if used in a TeX-style assignment as it is not an ⟨internal dimension⟩.
Analogous warnings can be found in the descriptions for skip_eval:n
and muskip_eval:n
with ⟨internal glue⟩ and ⟨internal muglue⟩ in place of ⟨internal dimension⟩.
I am fairly familiar with handling skips and dimensions in TeX, but I have never before come across the expression internal dimension. In the TeXbook I could not find any explanation of the phrase outside of the rather technical grammar notation in chapter 24, which surely contains all the necessary information but did not really help me.
So, what exactly is an internal dimension? What are other types of dimensions? (External dimensions?) What are examples of different behavior of the two (like the one alluded to by the warning above)?
tex-core syntax
add a comment |
In the documentation of l3skip
's dim_eval:n
one is warned
This [...] requires suitable termination if used in a TeX-style assignment as it is not an ⟨internal dimension⟩.
Analogous warnings can be found in the descriptions for skip_eval:n
and muskip_eval:n
with ⟨internal glue⟩ and ⟨internal muglue⟩ in place of ⟨internal dimension⟩.
I am fairly familiar with handling skips and dimensions in TeX, but I have never before come across the expression internal dimension. In the TeXbook I could not find any explanation of the phrase outside of the rather technical grammar notation in chapter 24, which surely contains all the necessary information but did not really help me.
So, what exactly is an internal dimension? What are other types of dimensions? (External dimensions?) What are examples of different behavior of the two (like the one alluded to by the warning above)?
tex-core syntax
In the documentation of l3skip
's dim_eval:n
one is warned
This [...] requires suitable termination if used in a TeX-style assignment as it is not an ⟨internal dimension⟩.
Analogous warnings can be found in the descriptions for skip_eval:n
and muskip_eval:n
with ⟨internal glue⟩ and ⟨internal muglue⟩ in place of ⟨internal dimension⟩.
I am fairly familiar with handling skips and dimensions in TeX, but I have never before come across the expression internal dimension. In the TeXbook I could not find any explanation of the phrase outside of the rather technical grammar notation in chapter 24, which surely contains all the necessary information but did not really help me.
So, what exactly is an internal dimension? What are other types of dimensions? (External dimensions?) What are examples of different behavior of the two (like the one alluded to by the warning above)?
tex-core syntax
tex-core syntax
asked 21 hours ago
schtandardschtandard
5,3031 gold badge13 silver badges31 bronze badges
5,3031 gold badge13 silver badges31 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I'll deal first with the general TeX concept, then why it's important in the documentation of those expl3
functions.
An internal dimension (or internal count or whatever) is something which has been parsed by TeX and is now stored in the correct form. Thus TeX 'knows' that an internal dimension is a valid dimension, and does not have to 'look' for any further material. In contrast, an external dimension (etc.) is something that is made up of discrete tokens and would have to be re-parsed by TeX to be used. Thus when we write 12.0pt
, we are giving an external representation (TeX would have to parse it to know it's a valid dimen), but after
newdimenmydimen
mydimen=12pt %
I can use mydimen
and TeX does not need to parse anything: mydimen
holds an internal dimension.
Why is this important? It's all about TeX's parsing rules, in particular that TeX allows an optional trailing space after dimensions, integers, etc., and more importantly that with an external representation, TeX doesn't stop parsing until it finds something that doesn't 'fit'. For example
deffoo{123}
newcountfooint
fooint=123 %
newcounttestint
%%%
testint=foo 456 %
showthetestint
testint=fooint 456 %
showthetestint
you'll see that the first case gives the wrong result: we have a macro which simply expands to 123
, and TeX keeps looking for an integer until we hit the optional space. In contrast, with an internal count representation, there is no question of parsing: fooint
is 123
.
The key point is that an internal representation is 'safer' to use (plus faster): there's never a question of where it terminates.
How does this relate to expl3
? Something like dim_eval:n
is used to take an expression and turn in into a dimension. However, it turns out to be convenient to allow that to also be just typeset, stored by expansion in a macro (tl
), etc. To do that, we have to arrange that the evaluation results in an external representation, not an internal one. That means that these functions behave like storing a value as a macro: you have to watch the termination.
For all 'pure' expl3
usage that's not an issue, as we have correct termination in the right places. But if you mix using these functions with more classical TeX programming, you need to know how they will behave. The answer by egreg shows this nicely.
For those who want the TeX details, dim_eval:n
is in primitive terms
thedimexpr #1relax
while if we want to end up with an internal representation we only want
dimexpr #1relax
However, that can't be used in typesetting or (successfully) inside an x
-type expansion, hence it's not suitable for the definition we want.
add a comment |
Consider the following example
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
cs_set_eq:NN dimeval dim_eval:n
ExplSyntaxOff
newlength{mylen}
begin{document}
Do an assignment mylen=dimeval{3pt+1cm} plus something else.
end{document}
which raises an error
! Missing number, treated as zero.
<to be read again>
s
l.12 ...assignment mylen=dimeval{3pt+1cm} plus s
omething else.
This is precisely what's referred to in interface3
.
An <internal dimension>
is any dimen
register or any internal register that stores a (rigid) length, such as parindent
; with e-TeX extensions, also dimexpr
is an instance of <internal dimension>
.
Another important fact is that newlength
allocates a skip
register, so TeX will look forward for plus
or minus
specifications; this doesn't occur when setlength
is used, because the macro provides the suitable relax
termination.
add a comment |
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
});
}
});
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%2f503868%2fwhat-is-an-internal-dimension-glue-muglue%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'll deal first with the general TeX concept, then why it's important in the documentation of those expl3
functions.
An internal dimension (or internal count or whatever) is something which has been parsed by TeX and is now stored in the correct form. Thus TeX 'knows' that an internal dimension is a valid dimension, and does not have to 'look' for any further material. In contrast, an external dimension (etc.) is something that is made up of discrete tokens and would have to be re-parsed by TeX to be used. Thus when we write 12.0pt
, we are giving an external representation (TeX would have to parse it to know it's a valid dimen), but after
newdimenmydimen
mydimen=12pt %
I can use mydimen
and TeX does not need to parse anything: mydimen
holds an internal dimension.
Why is this important? It's all about TeX's parsing rules, in particular that TeX allows an optional trailing space after dimensions, integers, etc., and more importantly that with an external representation, TeX doesn't stop parsing until it finds something that doesn't 'fit'. For example
deffoo{123}
newcountfooint
fooint=123 %
newcounttestint
%%%
testint=foo 456 %
showthetestint
testint=fooint 456 %
showthetestint
you'll see that the first case gives the wrong result: we have a macro which simply expands to 123
, and TeX keeps looking for an integer until we hit the optional space. In contrast, with an internal count representation, there is no question of parsing: fooint
is 123
.
The key point is that an internal representation is 'safer' to use (plus faster): there's never a question of where it terminates.
How does this relate to expl3
? Something like dim_eval:n
is used to take an expression and turn in into a dimension. However, it turns out to be convenient to allow that to also be just typeset, stored by expansion in a macro (tl
), etc. To do that, we have to arrange that the evaluation results in an external representation, not an internal one. That means that these functions behave like storing a value as a macro: you have to watch the termination.
For all 'pure' expl3
usage that's not an issue, as we have correct termination in the right places. But if you mix using these functions with more classical TeX programming, you need to know how they will behave. The answer by egreg shows this nicely.
For those who want the TeX details, dim_eval:n
is in primitive terms
thedimexpr #1relax
while if we want to end up with an internal representation we only want
dimexpr #1relax
However, that can't be used in typesetting or (successfully) inside an x
-type expansion, hence it's not suitable for the definition we want.
add a comment |
I'll deal first with the general TeX concept, then why it's important in the documentation of those expl3
functions.
An internal dimension (or internal count or whatever) is something which has been parsed by TeX and is now stored in the correct form. Thus TeX 'knows' that an internal dimension is a valid dimension, and does not have to 'look' for any further material. In contrast, an external dimension (etc.) is something that is made up of discrete tokens and would have to be re-parsed by TeX to be used. Thus when we write 12.0pt
, we are giving an external representation (TeX would have to parse it to know it's a valid dimen), but after
newdimenmydimen
mydimen=12pt %
I can use mydimen
and TeX does not need to parse anything: mydimen
holds an internal dimension.
Why is this important? It's all about TeX's parsing rules, in particular that TeX allows an optional trailing space after dimensions, integers, etc., and more importantly that with an external representation, TeX doesn't stop parsing until it finds something that doesn't 'fit'. For example
deffoo{123}
newcountfooint
fooint=123 %
newcounttestint
%%%
testint=foo 456 %
showthetestint
testint=fooint 456 %
showthetestint
you'll see that the first case gives the wrong result: we have a macro which simply expands to 123
, and TeX keeps looking for an integer until we hit the optional space. In contrast, with an internal count representation, there is no question of parsing: fooint
is 123
.
The key point is that an internal representation is 'safer' to use (plus faster): there's never a question of where it terminates.
How does this relate to expl3
? Something like dim_eval:n
is used to take an expression and turn in into a dimension. However, it turns out to be convenient to allow that to also be just typeset, stored by expansion in a macro (tl
), etc. To do that, we have to arrange that the evaluation results in an external representation, not an internal one. That means that these functions behave like storing a value as a macro: you have to watch the termination.
For all 'pure' expl3
usage that's not an issue, as we have correct termination in the right places. But if you mix using these functions with more classical TeX programming, you need to know how they will behave. The answer by egreg shows this nicely.
For those who want the TeX details, dim_eval:n
is in primitive terms
thedimexpr #1relax
while if we want to end up with an internal representation we only want
dimexpr #1relax
However, that can't be used in typesetting or (successfully) inside an x
-type expansion, hence it's not suitable for the definition we want.
add a comment |
I'll deal first with the general TeX concept, then why it's important in the documentation of those expl3
functions.
An internal dimension (or internal count or whatever) is something which has been parsed by TeX and is now stored in the correct form. Thus TeX 'knows' that an internal dimension is a valid dimension, and does not have to 'look' for any further material. In contrast, an external dimension (etc.) is something that is made up of discrete tokens and would have to be re-parsed by TeX to be used. Thus when we write 12.0pt
, we are giving an external representation (TeX would have to parse it to know it's a valid dimen), but after
newdimenmydimen
mydimen=12pt %
I can use mydimen
and TeX does not need to parse anything: mydimen
holds an internal dimension.
Why is this important? It's all about TeX's parsing rules, in particular that TeX allows an optional trailing space after dimensions, integers, etc., and more importantly that with an external representation, TeX doesn't stop parsing until it finds something that doesn't 'fit'. For example
deffoo{123}
newcountfooint
fooint=123 %
newcounttestint
%%%
testint=foo 456 %
showthetestint
testint=fooint 456 %
showthetestint
you'll see that the first case gives the wrong result: we have a macro which simply expands to 123
, and TeX keeps looking for an integer until we hit the optional space. In contrast, with an internal count representation, there is no question of parsing: fooint
is 123
.
The key point is that an internal representation is 'safer' to use (plus faster): there's never a question of where it terminates.
How does this relate to expl3
? Something like dim_eval:n
is used to take an expression and turn in into a dimension. However, it turns out to be convenient to allow that to also be just typeset, stored by expansion in a macro (tl
), etc. To do that, we have to arrange that the evaluation results in an external representation, not an internal one. That means that these functions behave like storing a value as a macro: you have to watch the termination.
For all 'pure' expl3
usage that's not an issue, as we have correct termination in the right places. But if you mix using these functions with more classical TeX programming, you need to know how they will behave. The answer by egreg shows this nicely.
For those who want the TeX details, dim_eval:n
is in primitive terms
thedimexpr #1relax
while if we want to end up with an internal representation we only want
dimexpr #1relax
However, that can't be used in typesetting or (successfully) inside an x
-type expansion, hence it's not suitable for the definition we want.
I'll deal first with the general TeX concept, then why it's important in the documentation of those expl3
functions.
An internal dimension (or internal count or whatever) is something which has been parsed by TeX and is now stored in the correct form. Thus TeX 'knows' that an internal dimension is a valid dimension, and does not have to 'look' for any further material. In contrast, an external dimension (etc.) is something that is made up of discrete tokens and would have to be re-parsed by TeX to be used. Thus when we write 12.0pt
, we are giving an external representation (TeX would have to parse it to know it's a valid dimen), but after
newdimenmydimen
mydimen=12pt %
I can use mydimen
and TeX does not need to parse anything: mydimen
holds an internal dimension.
Why is this important? It's all about TeX's parsing rules, in particular that TeX allows an optional trailing space after dimensions, integers, etc., and more importantly that with an external representation, TeX doesn't stop parsing until it finds something that doesn't 'fit'. For example
deffoo{123}
newcountfooint
fooint=123 %
newcounttestint
%%%
testint=foo 456 %
showthetestint
testint=fooint 456 %
showthetestint
you'll see that the first case gives the wrong result: we have a macro which simply expands to 123
, and TeX keeps looking for an integer until we hit the optional space. In contrast, with an internal count representation, there is no question of parsing: fooint
is 123
.
The key point is that an internal representation is 'safer' to use (plus faster): there's never a question of where it terminates.
How does this relate to expl3
? Something like dim_eval:n
is used to take an expression and turn in into a dimension. However, it turns out to be convenient to allow that to also be just typeset, stored by expansion in a macro (tl
), etc. To do that, we have to arrange that the evaluation results in an external representation, not an internal one. That means that these functions behave like storing a value as a macro: you have to watch the termination.
For all 'pure' expl3
usage that's not an issue, as we have correct termination in the right places. But if you mix using these functions with more classical TeX programming, you need to know how they will behave. The answer by egreg shows this nicely.
For those who want the TeX details, dim_eval:n
is in primitive terms
thedimexpr #1relax
while if we want to end up with an internal representation we only want
dimexpr #1relax
However, that can't be used in typesetting or (successfully) inside an x
-type expansion, hence it's not suitable for the definition we want.
edited 19 hours ago
schtandard
5,3031 gold badge13 silver badges31 bronze badges
5,3031 gold badge13 silver badges31 bronze badges
answered 20 hours ago
Joseph Wright♦Joseph Wright
210k24 gold badges574 silver badges904 bronze badges
210k24 gold badges574 silver badges904 bronze badges
add a comment |
add a comment |
Consider the following example
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
cs_set_eq:NN dimeval dim_eval:n
ExplSyntaxOff
newlength{mylen}
begin{document}
Do an assignment mylen=dimeval{3pt+1cm} plus something else.
end{document}
which raises an error
! Missing number, treated as zero.
<to be read again>
s
l.12 ...assignment mylen=dimeval{3pt+1cm} plus s
omething else.
This is precisely what's referred to in interface3
.
An <internal dimension>
is any dimen
register or any internal register that stores a (rigid) length, such as parindent
; with e-TeX extensions, also dimexpr
is an instance of <internal dimension>
.
Another important fact is that newlength
allocates a skip
register, so TeX will look forward for plus
or minus
specifications; this doesn't occur when setlength
is used, because the macro provides the suitable relax
termination.
add a comment |
Consider the following example
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
cs_set_eq:NN dimeval dim_eval:n
ExplSyntaxOff
newlength{mylen}
begin{document}
Do an assignment mylen=dimeval{3pt+1cm} plus something else.
end{document}
which raises an error
! Missing number, treated as zero.
<to be read again>
s
l.12 ...assignment mylen=dimeval{3pt+1cm} plus s
omething else.
This is precisely what's referred to in interface3
.
An <internal dimension>
is any dimen
register or any internal register that stores a (rigid) length, such as parindent
; with e-TeX extensions, also dimexpr
is an instance of <internal dimension>
.
Another important fact is that newlength
allocates a skip
register, so TeX will look forward for plus
or minus
specifications; this doesn't occur when setlength
is used, because the macro provides the suitable relax
termination.
add a comment |
Consider the following example
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
cs_set_eq:NN dimeval dim_eval:n
ExplSyntaxOff
newlength{mylen}
begin{document}
Do an assignment mylen=dimeval{3pt+1cm} plus something else.
end{document}
which raises an error
! Missing number, treated as zero.
<to be read again>
s
l.12 ...assignment mylen=dimeval{3pt+1cm} plus s
omething else.
This is precisely what's referred to in interface3
.
An <internal dimension>
is any dimen
register or any internal register that stores a (rigid) length, such as parindent
; with e-TeX extensions, also dimexpr
is an instance of <internal dimension>
.
Another important fact is that newlength
allocates a skip
register, so TeX will look forward for plus
or minus
specifications; this doesn't occur when setlength
is used, because the macro provides the suitable relax
termination.
Consider the following example
documentclass{article}
usepackage{expl3}
ExplSyntaxOn
cs_set_eq:NN dimeval dim_eval:n
ExplSyntaxOff
newlength{mylen}
begin{document}
Do an assignment mylen=dimeval{3pt+1cm} plus something else.
end{document}
which raises an error
! Missing number, treated as zero.
<to be read again>
s
l.12 ...assignment mylen=dimeval{3pt+1cm} plus s
omething else.
This is precisely what's referred to in interface3
.
An <internal dimension>
is any dimen
register or any internal register that stores a (rigid) length, such as parindent
; with e-TeX extensions, also dimexpr
is an instance of <internal dimension>
.
Another important fact is that newlength
allocates a skip
register, so TeX will look forward for plus
or minus
specifications; this doesn't occur when setlength
is used, because the macro provides the suitable relax
termination.
edited 20 hours ago
answered 20 hours ago
egregegreg
761k90 gold badges1989 silver badges3338 bronze badges
761k90 gold badges1989 silver badges3338 bronze badges
add a comment |
add a comment |
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%2f503868%2fwhat-is-an-internal-dimension-glue-muglue%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