About the definition of textcolor
Clash Royale CLAN TAG#URR8PPP
I was curious and found the following definition for the macro textcolor
defined in the package xcolor
:
deftextcolor#1#@textcolor#1
def@textcolor#1#2#3protectleavevmodecolor#1#2#3
However, I use the macro with only two arguments and not three arguments:
textcolorbluefoo
What I don't understand for this definition is:
- What is the meaning of the syntax
textcolor#1#
? - What will be the third argument the macro
@textcolor
will get in the example above?
color arguments texdef
add a comment |
I was curious and found the following definition for the macro textcolor
defined in the package xcolor
:
deftextcolor#1#@textcolor#1
def@textcolor#1#2#3protectleavevmodecolor#1#2#3
However, I use the macro with only two arguments and not three arguments:
textcolorbluefoo
What I don't understand for this definition is:
- What is the meaning of the syntax
textcolor#1#
? - What will be the third argument the macro
@textcolor
will get in the example above?
color arguments texdef
add a comment |
I was curious and found the following definition for the macro textcolor
defined in the package xcolor
:
deftextcolor#1#@textcolor#1
def@textcolor#1#2#3protectleavevmodecolor#1#2#3
However, I use the macro with only two arguments and not three arguments:
textcolorbluefoo
What I don't understand for this definition is:
- What is the meaning of the syntax
textcolor#1#
? - What will be the third argument the macro
@textcolor
will get in the example above?
color arguments texdef
I was curious and found the following definition for the macro textcolor
defined in the package xcolor
:
deftextcolor#1#@textcolor#1
def@textcolor#1#2#3protectleavevmodecolor#1#2#3
However, I use the macro with only two arguments and not three arguments:
textcolorbluefoo
What I don't understand for this definition is:
- What is the meaning of the syntax
textcolor#1#
? - What will be the third argument the macro
@textcolor
will get in the example above?
color arguments texdef
color arguments texdef
asked Feb 14 at 15:26
SaroupilleSaroupille
297210
297210
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This is primitive tex syntax that really shouldn't be used in a latex package. It's used here as in 1993 fitting this all into a 640K machine we were really short of space and saving a few dozen bytes by shortcutting the definition was worth it.
If you go
deffoo#1#zzz #1 zzz
then #1
is everything from foo
to the first brace, so
foo one two three zzz
then #1
would be one two three
Using this allows textcolor
to grab any optional arguments without actually parsing for them and then re-insert them so color
sees them.
so compare
textcolorbluefoo
and
textcolor[rgb]0,0,1foo
in the first case #1
is empty so the expansion is
@textcolorbluefoo
which is
protectleavevmodecolorbluefoo
but in the second case #1
is [rgb]
(including the brackets) so the first expansion is
@textcolor[rgb]0,0,1foo
which is
protectleavevmodecolor[rgb]0,0,1foo
so the [rgb]
isn't really ever seen by textcolor
as an optional argument, it is just grabbed and passed to color
.
Thank you for your clear answer. Is the second sharp after#1
really necessary then?
– Saroupille
Feb 14 at 17:42
1
@Saroupille Yes, otherwise it would only read the first token aftertextcolor
which would be[
in the case of an optional argument.
– TeXnician
Feb 14 at 19:22
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%2f474884%2fabout-the-definition-of-textcolor%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
This is primitive tex syntax that really shouldn't be used in a latex package. It's used here as in 1993 fitting this all into a 640K machine we were really short of space and saving a few dozen bytes by shortcutting the definition was worth it.
If you go
deffoo#1#zzz #1 zzz
then #1
is everything from foo
to the first brace, so
foo one two three zzz
then #1
would be one two three
Using this allows textcolor
to grab any optional arguments without actually parsing for them and then re-insert them so color
sees them.
so compare
textcolorbluefoo
and
textcolor[rgb]0,0,1foo
in the first case #1
is empty so the expansion is
@textcolorbluefoo
which is
protectleavevmodecolorbluefoo
but in the second case #1
is [rgb]
(including the brackets) so the first expansion is
@textcolor[rgb]0,0,1foo
which is
protectleavevmodecolor[rgb]0,0,1foo
so the [rgb]
isn't really ever seen by textcolor
as an optional argument, it is just grabbed and passed to color
.
Thank you for your clear answer. Is the second sharp after#1
really necessary then?
– Saroupille
Feb 14 at 17:42
1
@Saroupille Yes, otherwise it would only read the first token aftertextcolor
which would be[
in the case of an optional argument.
– TeXnician
Feb 14 at 19:22
add a comment |
This is primitive tex syntax that really shouldn't be used in a latex package. It's used here as in 1993 fitting this all into a 640K machine we were really short of space and saving a few dozen bytes by shortcutting the definition was worth it.
If you go
deffoo#1#zzz #1 zzz
then #1
is everything from foo
to the first brace, so
foo one two three zzz
then #1
would be one two three
Using this allows textcolor
to grab any optional arguments without actually parsing for them and then re-insert them so color
sees them.
so compare
textcolorbluefoo
and
textcolor[rgb]0,0,1foo
in the first case #1
is empty so the expansion is
@textcolorbluefoo
which is
protectleavevmodecolorbluefoo
but in the second case #1
is [rgb]
(including the brackets) so the first expansion is
@textcolor[rgb]0,0,1foo
which is
protectleavevmodecolor[rgb]0,0,1foo
so the [rgb]
isn't really ever seen by textcolor
as an optional argument, it is just grabbed and passed to color
.
Thank you for your clear answer. Is the second sharp after#1
really necessary then?
– Saroupille
Feb 14 at 17:42
1
@Saroupille Yes, otherwise it would only read the first token aftertextcolor
which would be[
in the case of an optional argument.
– TeXnician
Feb 14 at 19:22
add a comment |
This is primitive tex syntax that really shouldn't be used in a latex package. It's used here as in 1993 fitting this all into a 640K machine we were really short of space and saving a few dozen bytes by shortcutting the definition was worth it.
If you go
deffoo#1#zzz #1 zzz
then #1
is everything from foo
to the first brace, so
foo one two three zzz
then #1
would be one two three
Using this allows textcolor
to grab any optional arguments without actually parsing for them and then re-insert them so color
sees them.
so compare
textcolorbluefoo
and
textcolor[rgb]0,0,1foo
in the first case #1
is empty so the expansion is
@textcolorbluefoo
which is
protectleavevmodecolorbluefoo
but in the second case #1
is [rgb]
(including the brackets) so the first expansion is
@textcolor[rgb]0,0,1foo
which is
protectleavevmodecolor[rgb]0,0,1foo
so the [rgb]
isn't really ever seen by textcolor
as an optional argument, it is just grabbed and passed to color
.
This is primitive tex syntax that really shouldn't be used in a latex package. It's used here as in 1993 fitting this all into a 640K machine we were really short of space and saving a few dozen bytes by shortcutting the definition was worth it.
If you go
deffoo#1#zzz #1 zzz
then #1
is everything from foo
to the first brace, so
foo one two three zzz
then #1
would be one two three
Using this allows textcolor
to grab any optional arguments without actually parsing for them and then re-insert them so color
sees them.
so compare
textcolorbluefoo
and
textcolor[rgb]0,0,1foo
in the first case #1
is empty so the expansion is
@textcolorbluefoo
which is
protectleavevmodecolorbluefoo
but in the second case #1
is [rgb]
(including the brackets) so the first expansion is
@textcolor[rgb]0,0,1foo
which is
protectleavevmodecolor[rgb]0,0,1foo
so the [rgb]
isn't really ever seen by textcolor
as an optional argument, it is just grabbed and passed to color
.
edited Feb 14 at 17:10
answered Feb 14 at 16:55
David CarlisleDavid Carlisle
494k4111371885
494k4111371885
Thank you for your clear answer. Is the second sharp after#1
really necessary then?
– Saroupille
Feb 14 at 17:42
1
@Saroupille Yes, otherwise it would only read the first token aftertextcolor
which would be[
in the case of an optional argument.
– TeXnician
Feb 14 at 19:22
add a comment |
Thank you for your clear answer. Is the second sharp after#1
really necessary then?
– Saroupille
Feb 14 at 17:42
1
@Saroupille Yes, otherwise it would only read the first token aftertextcolor
which would be[
in the case of an optional argument.
– TeXnician
Feb 14 at 19:22
Thank you for your clear answer. Is the second sharp after
#1
really necessary then?– Saroupille
Feb 14 at 17:42
Thank you for your clear answer. Is the second sharp after
#1
really necessary then?– Saroupille
Feb 14 at 17:42
1
1
@Saroupille Yes, otherwise it would only read the first token after
textcolor
which would be [
in the case of an optional argument.– TeXnician
Feb 14 at 19:22
@Saroupille Yes, otherwise it would only read the first token after
textcolor
which would be [
in the case of an optional argument.– TeXnician
Feb 14 at 19:22
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%2f474884%2fabout-the-definition-of-textcolor%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