Protected expansion in expl3
I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef
, that is expanding a token list while respecting the protect
mechanism of latex2e.
Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx
) seems to expand everything ignoring the latex2e protection mechanism.
I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef
, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand }
right before the "x" expansion (e.g., before the tl_gset:Nx
), but I wonder if this is the preferred method or if there are more elegant alternatives.
expl3
add a comment |
I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef
, that is expanding a token list while respecting the protect
mechanism of latex2e.
Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx
) seems to expand everything ignoring the latex2e protection mechanism.
I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef
, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand }
right before the "x" expansion (e.g., before the tl_gset:Nx
), but I wonder if this is the preferred method or if there are more elegant alternatives.
expl3
add a comment |
I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef
, that is expanding a token list while respecting the protect
mechanism of latex2e.
Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx
) seems to expand everything ignoring the latex2e protection mechanism.
I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef
, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand }
right before the "x" expansion (e.g., before the tl_gset:Nx
), but I wonder if this is the preferred method or if there are more elegant alternatives.
expl3
I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e protected@edef
, that is expanding a token list while respecting the protect
mechanism of latex2e.
Using expl3 functions with an "x" type argument (e.g. tl_gset:Nx
) seems to expand everything ignoring the latex2e protection mechanism.
I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by protected@edef
, that is by doing a tl_set:Nn protect { noexpandprotectnoexpand }
right before the "x" expansion (e.g., before the tl_gset:Nx
), but I wonder if this is the preferred method or if there are more elegant alternatives.
expl3
expl3
asked Dec 25 '18 at 21:12
CallegarCallegar
1012
1012
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There is no equivalent of protected@edef
in expl3
as 'native' expl3
material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3
, you'll need to stick to the LaTeX2e mechanism
protected@edef l_tmpa_tl { <stuff> }
While this is correct as far as pure expl3 code is concerned, the fact that we see more and more packages written in expl3 but intended to work seamlessly in 2e context means that we have to provide interfaces to certain 2e data structures and conventions to make this possible. the protect mechanism is a good example because it should be possible for expl3 code to receive user data from a document and manipulate it with ease and in a cleaner way than currently possible.
– Frank Mittelbach
Dec 26 '18 at 20:30
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%2f467329%2fprotected-expansion-in-expl3%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no equivalent of protected@edef
in expl3
as 'native' expl3
material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3
, you'll need to stick to the LaTeX2e mechanism
protected@edef l_tmpa_tl { <stuff> }
While this is correct as far as pure expl3 code is concerned, the fact that we see more and more packages written in expl3 but intended to work seamlessly in 2e context means that we have to provide interfaces to certain 2e data structures and conventions to make this possible. the protect mechanism is a good example because it should be possible for expl3 code to receive user data from a document and manipulate it with ease and in a cleaner way than currently possible.
– Frank Mittelbach
Dec 26 '18 at 20:30
add a comment |
There is no equivalent of protected@edef
in expl3
as 'native' expl3
material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3
, you'll need to stick to the LaTeX2e mechanism
protected@edef l_tmpa_tl { <stuff> }
While this is correct as far as pure expl3 code is concerned, the fact that we see more and more packages written in expl3 but intended to work seamlessly in 2e context means that we have to provide interfaces to certain 2e data structures and conventions to make this possible. the protect mechanism is a good example because it should be possible for expl3 code to receive user data from a document and manipulate it with ease and in a cleaner way than currently possible.
– Frank Mittelbach
Dec 26 '18 at 20:30
add a comment |
There is no equivalent of protected@edef
in expl3
as 'native' expl3
material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3
, you'll need to stick to the LaTeX2e mechanism
protected@edef l_tmpa_tl { <stuff> }
There is no equivalent of protected@edef
in expl3
as 'native' expl3
material is either fully expandable or engine-protected. As such, if you do need to take mixed LaTeX2e input and use it in expl3
, you'll need to stick to the LaTeX2e mechanism
protected@edef l_tmpa_tl { <stuff> }
edited Dec 25 '18 at 22:01
answered Dec 25 '18 at 21:22
Joseph Wright♦Joseph Wright
205k23564892
205k23564892
While this is correct as far as pure expl3 code is concerned, the fact that we see more and more packages written in expl3 but intended to work seamlessly in 2e context means that we have to provide interfaces to certain 2e data structures and conventions to make this possible. the protect mechanism is a good example because it should be possible for expl3 code to receive user data from a document and manipulate it with ease and in a cleaner way than currently possible.
– Frank Mittelbach
Dec 26 '18 at 20:30
add a comment |
While this is correct as far as pure expl3 code is concerned, the fact that we see more and more packages written in expl3 but intended to work seamlessly in 2e context means that we have to provide interfaces to certain 2e data structures and conventions to make this possible. the protect mechanism is a good example because it should be possible for expl3 code to receive user data from a document and manipulate it with ease and in a cleaner way than currently possible.
– Frank Mittelbach
Dec 26 '18 at 20:30
While this is correct as far as pure expl3 code is concerned, the fact that we see more and more packages written in expl3 but intended to work seamlessly in 2e context means that we have to provide interfaces to certain 2e data structures and conventions to make this possible. the protect mechanism is a good example because it should be possible for expl3 code to receive user data from a document and manipulate it with ease and in a cleaner way than currently possible.
– Frank Mittelbach
Dec 26 '18 at 20:30
While this is correct as far as pure expl3 code is concerned, the fact that we see more and more packages written in expl3 but intended to work seamlessly in 2e context means that we have to provide interfaces to certain 2e data structures and conventions to make this possible. the protect mechanism is a good example because it should be possible for expl3 code to receive user data from a document and manipulate it with ease and in a cleaner way than currently possible.
– Frank Mittelbach
Dec 26 '18 at 20:30
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%2f467329%2fprotected-expansion-in-expl3%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