Non-alphabet letter in csname …endcsname
Why can't I get what I want in the following code?
MWE:
documentclass{article}
begin{document}
%
defaaa*{*}
defaaaAAA{AAA}
|csname aaaAAAendcsname|% typeset |AAA| as I desired.
|csname aaa*endcsname|% I want to get |*|, but get ||. So, what's wrong with my code?
%
end{document}
tex-core
add a comment |
Why can't I get what I want in the following code?
MWE:
documentclass{article}
begin{document}
%
defaaa*{*}
defaaaAAA{AAA}
|csname aaaAAAendcsname|% typeset |AAA| as I desired.
|csname aaa*endcsname|% I want to get |*|, but get ||. So, what's wrong with my code?
%
end{document}
tex-core
1
defaaa*{*}
does not define a macro calledaaa*
. It defines a macro calledaaa
that must always be followed by a*
.|csname aaaendcsname*|
would give you the output ofaaa*
. To defineaaa*
you needexpandafterdefcsname aaa*endcsname{*}
.
– moewe
Feb 1 at 8:17
add a comment |
Why can't I get what I want in the following code?
MWE:
documentclass{article}
begin{document}
%
defaaa*{*}
defaaaAAA{AAA}
|csname aaaAAAendcsname|% typeset |AAA| as I desired.
|csname aaa*endcsname|% I want to get |*|, but get ||. So, what's wrong with my code?
%
end{document}
tex-core
Why can't I get what I want in the following code?
MWE:
documentclass{article}
begin{document}
%
defaaa*{*}
defaaaAAA{AAA}
|csname aaaAAAendcsname|% typeset |AAA| as I desired.
|csname aaa*endcsname|% I want to get |*|, but get ||. So, what's wrong with my code?
%
end{document}
tex-core
tex-core
asked Feb 1 at 8:01
lyllyl
70638
70638
1
defaaa*{*}
does not define a macro calledaaa*
. It defines a macro calledaaa
that must always be followed by a*
.|csname aaaendcsname*|
would give you the output ofaaa*
. To defineaaa*
you needexpandafterdefcsname aaa*endcsname{*}
.
– moewe
Feb 1 at 8:17
add a comment |
1
defaaa*{*}
does not define a macro calledaaa*
. It defines a macro calledaaa
that must always be followed by a*
.|csname aaaendcsname*|
would give you the output ofaaa*
. To defineaaa*
you needexpandafterdefcsname aaa*endcsname{*}
.
– moewe
Feb 1 at 8:17
1
1
defaaa*{*}
does not define a macro called aaa*
. It defines a macro called aaa
that must always be followed by a *
. |csname aaaendcsname*|
would give you the output of aaa*
. To define aaa*
you need expandafterdefcsname aaa*endcsname{*}
.– moewe
Feb 1 at 8:17
defaaa*{*}
does not define a macro called aaa*
. It defines a macro called aaa
that must always be followed by a *
. |csname aaaendcsname*|
would give you the output of aaa*
. To define aaa*
you need expandafterdefcsname aaa*endcsname{*}
.– moewe
Feb 1 at 8:17
add a comment |
2 Answers
2
active
oldest
votes
That's because csname aaa*endcsname
does not exist and therefore defaults to relax
which typesets nothing. Why does it not exist? Well, the problem is similar to No makeatletter
required?:
In defaaa*{*}
, *
does not form part of the definition, but instead forms part of the parameter text used. In order to define a macro to include a *
in the definition name you'll have to use
expandafterdefcsname aaa*endcsname{*}% Similar to @namedef{aaa*}{*}
add a comment |
Consider the following example
defaaa*{*}
showaaa*
Running TeX on it (any flavor), will report as follows on the console
> aaa=macro:
*->*.
l.3 showaaa
*
?
How do we read it? The primitive command show
reports the meaning of the following token; the to lines before the question mark tell us that aaa*
are two tokens, because *
appears in the continuation line.
TeX is also telling us that aaa
is a macro that has a nonempty parameter text (what's reported before ->
) consisting of an asterisk. In other words, defaaa*{*}
instructs TeX that aaa
must be followed by *
and the two tokens will be replaced by *
.
For instance, you can call it also as
aaa *
because the space after aaa
is ignored when building tokens from input.
If you want to use csname
, then it should be
csname aaaendcsname *
(the space before *
is optional).
In case you're wondering how *-variants are implemented in LaTeX, here it is:
newcommand{foo}{@ifstarfoostarfoonostar}
newcommand{foostar}{<what we want foo* to do>}
newcommand{foonostar}{<what we want foo to do>}
Possible arguments have to be grabbed by foostar
or foonostar
, depending on the desired syntax.
The approach with xparse
is slightly different, but the command will not have the *
as part of the name nonetheless.
Thank you so much for these detail explanations
– lyl
Feb 1 at 12:44
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%2f472839%2fnon-alphabet-letter-in-csname-endcsname%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
That's because csname aaa*endcsname
does not exist and therefore defaults to relax
which typesets nothing. Why does it not exist? Well, the problem is similar to No makeatletter
required?:
In defaaa*{*}
, *
does not form part of the definition, but instead forms part of the parameter text used. In order to define a macro to include a *
in the definition name you'll have to use
expandafterdefcsname aaa*endcsname{*}% Similar to @namedef{aaa*}{*}
add a comment |
That's because csname aaa*endcsname
does not exist and therefore defaults to relax
which typesets nothing. Why does it not exist? Well, the problem is similar to No makeatletter
required?:
In defaaa*{*}
, *
does not form part of the definition, but instead forms part of the parameter text used. In order to define a macro to include a *
in the definition name you'll have to use
expandafterdefcsname aaa*endcsname{*}% Similar to @namedef{aaa*}{*}
add a comment |
That's because csname aaa*endcsname
does not exist and therefore defaults to relax
which typesets nothing. Why does it not exist? Well, the problem is similar to No makeatletter
required?:
In defaaa*{*}
, *
does not form part of the definition, but instead forms part of the parameter text used. In order to define a macro to include a *
in the definition name you'll have to use
expandafterdefcsname aaa*endcsname{*}% Similar to @namedef{aaa*}{*}
That's because csname aaa*endcsname
does not exist and therefore defaults to relax
which typesets nothing. Why does it not exist? Well, the problem is similar to No makeatletter
required?:
In defaaa*{*}
, *
does not form part of the definition, but instead forms part of the parameter text used. In order to define a macro to include a *
in the definition name you'll have to use
expandafterdefcsname aaa*endcsname{*}% Similar to @namedef{aaa*}{*}
answered Feb 1 at 8:18


WernerWerner
450k729981706
450k729981706
add a comment |
add a comment |
Consider the following example
defaaa*{*}
showaaa*
Running TeX on it (any flavor), will report as follows on the console
> aaa=macro:
*->*.
l.3 showaaa
*
?
How do we read it? The primitive command show
reports the meaning of the following token; the to lines before the question mark tell us that aaa*
are two tokens, because *
appears in the continuation line.
TeX is also telling us that aaa
is a macro that has a nonempty parameter text (what's reported before ->
) consisting of an asterisk. In other words, defaaa*{*}
instructs TeX that aaa
must be followed by *
and the two tokens will be replaced by *
.
For instance, you can call it also as
aaa *
because the space after aaa
is ignored when building tokens from input.
If you want to use csname
, then it should be
csname aaaendcsname *
(the space before *
is optional).
In case you're wondering how *-variants are implemented in LaTeX, here it is:
newcommand{foo}{@ifstarfoostarfoonostar}
newcommand{foostar}{<what we want foo* to do>}
newcommand{foonostar}{<what we want foo to do>}
Possible arguments have to be grabbed by foostar
or foonostar
, depending on the desired syntax.
The approach with xparse
is slightly different, but the command will not have the *
as part of the name nonetheless.
Thank you so much for these detail explanations
– lyl
Feb 1 at 12:44
add a comment |
Consider the following example
defaaa*{*}
showaaa*
Running TeX on it (any flavor), will report as follows on the console
> aaa=macro:
*->*.
l.3 showaaa
*
?
How do we read it? The primitive command show
reports the meaning of the following token; the to lines before the question mark tell us that aaa*
are two tokens, because *
appears in the continuation line.
TeX is also telling us that aaa
is a macro that has a nonempty parameter text (what's reported before ->
) consisting of an asterisk. In other words, defaaa*{*}
instructs TeX that aaa
must be followed by *
and the two tokens will be replaced by *
.
For instance, you can call it also as
aaa *
because the space after aaa
is ignored when building tokens from input.
If you want to use csname
, then it should be
csname aaaendcsname *
(the space before *
is optional).
In case you're wondering how *-variants are implemented in LaTeX, here it is:
newcommand{foo}{@ifstarfoostarfoonostar}
newcommand{foostar}{<what we want foo* to do>}
newcommand{foonostar}{<what we want foo to do>}
Possible arguments have to be grabbed by foostar
or foonostar
, depending on the desired syntax.
The approach with xparse
is slightly different, but the command will not have the *
as part of the name nonetheless.
Thank you so much for these detail explanations
– lyl
Feb 1 at 12:44
add a comment |
Consider the following example
defaaa*{*}
showaaa*
Running TeX on it (any flavor), will report as follows on the console
> aaa=macro:
*->*.
l.3 showaaa
*
?
How do we read it? The primitive command show
reports the meaning of the following token; the to lines before the question mark tell us that aaa*
are two tokens, because *
appears in the continuation line.
TeX is also telling us that aaa
is a macro that has a nonempty parameter text (what's reported before ->
) consisting of an asterisk. In other words, defaaa*{*}
instructs TeX that aaa
must be followed by *
and the two tokens will be replaced by *
.
For instance, you can call it also as
aaa *
because the space after aaa
is ignored when building tokens from input.
If you want to use csname
, then it should be
csname aaaendcsname *
(the space before *
is optional).
In case you're wondering how *-variants are implemented in LaTeX, here it is:
newcommand{foo}{@ifstarfoostarfoonostar}
newcommand{foostar}{<what we want foo* to do>}
newcommand{foonostar}{<what we want foo to do>}
Possible arguments have to be grabbed by foostar
or foonostar
, depending on the desired syntax.
The approach with xparse
is slightly different, but the command will not have the *
as part of the name nonetheless.
Consider the following example
defaaa*{*}
showaaa*
Running TeX on it (any flavor), will report as follows on the console
> aaa=macro:
*->*.
l.3 showaaa
*
?
How do we read it? The primitive command show
reports the meaning of the following token; the to lines before the question mark tell us that aaa*
are two tokens, because *
appears in the continuation line.
TeX is also telling us that aaa
is a macro that has a nonempty parameter text (what's reported before ->
) consisting of an asterisk. In other words, defaaa*{*}
instructs TeX that aaa
must be followed by *
and the two tokens will be replaced by *
.
For instance, you can call it also as
aaa *
because the space after aaa
is ignored when building tokens from input.
If you want to use csname
, then it should be
csname aaaendcsname *
(the space before *
is optional).
In case you're wondering how *-variants are implemented in LaTeX, here it is:
newcommand{foo}{@ifstarfoostarfoonostar}
newcommand{foostar}{<what we want foo* to do>}
newcommand{foonostar}{<what we want foo to do>}
Possible arguments have to be grabbed by foostar
or foonostar
, depending on the desired syntax.
The approach with xparse
is slightly different, but the command will not have the *
as part of the name nonetheless.
answered Feb 1 at 8:33


egregegreg
733k8919313254
733k8919313254
Thank you so much for these detail explanations
– lyl
Feb 1 at 12:44
add a comment |
Thank you so much for these detail explanations
– lyl
Feb 1 at 12:44
Thank you so much for these detail explanations
– lyl
Feb 1 at 12:44
Thank you so much for these detail explanations
– lyl
Feb 1 at 12:44
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%2f472839%2fnon-alphabet-letter-in-csname-endcsname%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
1
defaaa*{*}
does not define a macro calledaaa*
. It defines a macro calledaaa
that must always be followed by a*
.|csname aaaendcsname*|
would give you the output ofaaa*
. To defineaaa*
you needexpandafterdefcsname aaa*endcsname{*}
.– moewe
Feb 1 at 8:17