What is this newcommand argument? [duplicate]
Clash Royale CLAN TAG#URR8PPP
This question already has an answer here:
newcommand argument confusion
4 answers
newcommand*name[1][C]{%
I have come very familiar with newcommand
however, I came across this line of code and i do not know what the [C]
is for.
macros arguments
marked as duplicate by Alan Munn, Stefan Pinnow, Kurt, Henri Menke, Andrew Swann Jan 21 at 8:18
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
newcommand argument confusion
4 answers
newcommand*name[1][C]{%
I have come very familiar with newcommand
however, I came across this line of code and i do not know what the [C]
is for.
macros arguments
marked as duplicate by Alan Munn, Stefan Pinnow, Kurt, Henri Menke, Andrew Swann Jan 21 at 8:18
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
Welcome to TeX.SE! This means in this case thatname
has one optional argument whose default value isC
.
– marmot
Jan 21 at 3:30
latexref.xyz/…
– Henri Menke
Jan 21 at 3:39
@HenriMenke Is there a more modern link in which things likeit
do not get advertized?
– marmot
Jan 21 at 3:54
@marmot Well,it
etc. are commands provided by the standard LaTeX classes, so naturally they would be listed in a reference manual. However, you can contribute and remove them latexref.xyz/dev/writing.html
– Henri Menke
Jan 21 at 4:08
@HenriMenke Please don't get me wrong, this was not meant to criticize you. I have just seen so many cases in which users, especially new users, got interesting comments when they were usingit
and so on. Therefore I am really wondering if there are sources of the same information which a free of such relics.
– marmot
Jan 21 at 4:13
add a comment |
This question already has an answer here:
newcommand argument confusion
4 answers
newcommand*name[1][C]{%
I have come very familiar with newcommand
however, I came across this line of code and i do not know what the [C]
is for.
macros arguments
This question already has an answer here:
newcommand argument confusion
4 answers
newcommand*name[1][C]{%
I have come very familiar with newcommand
however, I came across this line of code and i do not know what the [C]
is for.
This question already has an answer here:
newcommand argument confusion
4 answers
macros arguments
macros arguments
edited Jan 21 at 6:21
Werner
443k679781675
443k679781675
asked Jan 21 at 3:30
Jesus EscarenoJesus Escareno
111
111
marked as duplicate by Alan Munn, Stefan Pinnow, Kurt, Henri Menke, Andrew Swann Jan 21 at 8:18
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Alan Munn, Stefan Pinnow, Kurt, Henri Menke, Andrew Swann Jan 21 at 8:18
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
Welcome to TeX.SE! This means in this case thatname
has one optional argument whose default value isC
.
– marmot
Jan 21 at 3:30
latexref.xyz/…
– Henri Menke
Jan 21 at 3:39
@HenriMenke Is there a more modern link in which things likeit
do not get advertized?
– marmot
Jan 21 at 3:54
@marmot Well,it
etc. are commands provided by the standard LaTeX classes, so naturally they would be listed in a reference manual. However, you can contribute and remove them latexref.xyz/dev/writing.html
– Henri Menke
Jan 21 at 4:08
@HenriMenke Please don't get me wrong, this was not meant to criticize you. I have just seen so many cases in which users, especially new users, got interesting comments when they were usingit
and so on. Therefore I am really wondering if there are sources of the same information which a free of such relics.
– marmot
Jan 21 at 4:13
add a comment |
2
Welcome to TeX.SE! This means in this case thatname
has one optional argument whose default value isC
.
– marmot
Jan 21 at 3:30
latexref.xyz/…
– Henri Menke
Jan 21 at 3:39
@HenriMenke Is there a more modern link in which things likeit
do not get advertized?
– marmot
Jan 21 at 3:54
@marmot Well,it
etc. are commands provided by the standard LaTeX classes, so naturally they would be listed in a reference manual. However, you can contribute and remove them latexref.xyz/dev/writing.html
– Henri Menke
Jan 21 at 4:08
@HenriMenke Please don't get me wrong, this was not meant to criticize you. I have just seen so many cases in which users, especially new users, got interesting comments when they were usingit
and so on. Therefore I am really wondering if there are sources of the same information which a free of such relics.
– marmot
Jan 21 at 4:13
2
2
Welcome to TeX.SE! This means in this case that
name
has one optional argument whose default value is C
.– marmot
Jan 21 at 3:30
Welcome to TeX.SE! This means in this case that
name
has one optional argument whose default value is C
.– marmot
Jan 21 at 3:30
latexref.xyz/…
– Henri Menke
Jan 21 at 3:39
latexref.xyz/…
– Henri Menke
Jan 21 at 3:39
@HenriMenke Is there a more modern link in which things like
it
do not get advertized?– marmot
Jan 21 at 3:54
@HenriMenke Is there a more modern link in which things like
it
do not get advertized?– marmot
Jan 21 at 3:54
@marmot Well,
it
etc. are commands provided by the standard LaTeX classes, so naturally they would be listed in a reference manual. However, you can contribute and remove them latexref.xyz/dev/writing.html– Henri Menke
Jan 21 at 4:08
@marmot Well,
it
etc. are commands provided by the standard LaTeX classes, so naturally they would be listed in a reference manual. However, you can contribute and remove them latexref.xyz/dev/writing.html– Henri Menke
Jan 21 at 4:08
@HenriMenke Please don't get me wrong, this was not meant to criticize you. I have just seen so many cases in which users, especially new users, got interesting comments when they were using
it
and so on. Therefore I am really wondering if there are sources of the same information which a free of such relics.– marmot
Jan 21 at 4:13
@HenriMenke Please don't get me wrong, this was not meant to criticize you. I have just seen so many cases in which users, especially new users, got interesting comments when they were using
it
and so on. Therefore I am really wondering if there are sources of the same information which a free of such relics.– marmot
Jan 21 at 4:13
add a comment |
1 Answer
1
active
oldest
votes
LaTeX's newcommand
has the following syntax:
newcommand *<FOO>[<i>]<TEXT>
User command to define
FOO
to be a macro withi
arguments (i
= 0 if missing)
having the definition<TEXT>
. Produces an error ifFOO
already defined.
Normally the command is defined to belong
(i.e. it may take multiple paragraphs in its argument). In the star-form, the command is not defined aslong
and a blank line in any argument to the command would generate an error.
If you define a command with at least one argument (i
> 0), you can specify an additional (optional) argument before the definition <TEXT>
. This optional argument will be used as the "default" value for a first optional argument to FOO
.
So, as an example, consider
newcommandFOO[2]<TEXT>
This command has two mandatory arguments and is therefore used as FOO<one><two>
. However,
newcommandFOO[2][X]<TEXT>
takes two (2
) arguments, the first of which is optional and has a default of X
(if not supplied). You can use it as FOO<one>
(which is equivalent to FOO[X]<one>
) or FOO[<one>]<two>
. Similarly,
newcommandFOO[1][X]<TEXT>
takes a single (1
) optional argument that has a default value of X
(if not supplied) and can be used as FOO
(which is equivalent to FOO[X]
) or FOO[<one>]
.
In your particular case,
newcommand*name[1][C]<TEXT>
defines name
to (be non-long
; that is, <TEXT>
cannot have blank lines and) take a single (1
) optional argument that defaults to C
if not supplied. You can use it as name
(which is equivalent to name[C]
) or name[<one>]
.
Reference:
LaTeX2e sources
What do
newcommand
,renewcommand
, andprovidecommand
do, and how do they differ?What is the difference between
def
andnewcommand
?
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
LaTeX's newcommand
has the following syntax:
newcommand *<FOO>[<i>]<TEXT>
User command to define
FOO
to be a macro withi
arguments (i
= 0 if missing)
having the definition<TEXT>
. Produces an error ifFOO
already defined.
Normally the command is defined to belong
(i.e. it may take multiple paragraphs in its argument). In the star-form, the command is not defined aslong
and a blank line in any argument to the command would generate an error.
If you define a command with at least one argument (i
> 0), you can specify an additional (optional) argument before the definition <TEXT>
. This optional argument will be used as the "default" value for a first optional argument to FOO
.
So, as an example, consider
newcommandFOO[2]<TEXT>
This command has two mandatory arguments and is therefore used as FOO<one><two>
. However,
newcommandFOO[2][X]<TEXT>
takes two (2
) arguments, the first of which is optional and has a default of X
(if not supplied). You can use it as FOO<one>
(which is equivalent to FOO[X]<one>
) or FOO[<one>]<two>
. Similarly,
newcommandFOO[1][X]<TEXT>
takes a single (1
) optional argument that has a default value of X
(if not supplied) and can be used as FOO
(which is equivalent to FOO[X]
) or FOO[<one>]
.
In your particular case,
newcommand*name[1][C]<TEXT>
defines name
to (be non-long
; that is, <TEXT>
cannot have blank lines and) take a single (1
) optional argument that defaults to C
if not supplied. You can use it as name
(which is equivalent to name[C]
) or name[<one>]
.
Reference:
LaTeX2e sources
What do
newcommand
,renewcommand
, andprovidecommand
do, and how do they differ?What is the difference between
def
andnewcommand
?
add a comment |
LaTeX's newcommand
has the following syntax:
newcommand *<FOO>[<i>]<TEXT>
User command to define
FOO
to be a macro withi
arguments (i
= 0 if missing)
having the definition<TEXT>
. Produces an error ifFOO
already defined.
Normally the command is defined to belong
(i.e. it may take multiple paragraphs in its argument). In the star-form, the command is not defined aslong
and a blank line in any argument to the command would generate an error.
If you define a command with at least one argument (i
> 0), you can specify an additional (optional) argument before the definition <TEXT>
. This optional argument will be used as the "default" value for a first optional argument to FOO
.
So, as an example, consider
newcommandFOO[2]<TEXT>
This command has two mandatory arguments and is therefore used as FOO<one><two>
. However,
newcommandFOO[2][X]<TEXT>
takes two (2
) arguments, the first of which is optional and has a default of X
(if not supplied). You can use it as FOO<one>
(which is equivalent to FOO[X]<one>
) or FOO[<one>]<two>
. Similarly,
newcommandFOO[1][X]<TEXT>
takes a single (1
) optional argument that has a default value of X
(if not supplied) and can be used as FOO
(which is equivalent to FOO[X]
) or FOO[<one>]
.
In your particular case,
newcommand*name[1][C]<TEXT>
defines name
to (be non-long
; that is, <TEXT>
cannot have blank lines and) take a single (1
) optional argument that defaults to C
if not supplied. You can use it as name
(which is equivalent to name[C]
) or name[<one>]
.
Reference:
LaTeX2e sources
What do
newcommand
,renewcommand
, andprovidecommand
do, and how do they differ?What is the difference between
def
andnewcommand
?
add a comment |
LaTeX's newcommand
has the following syntax:
newcommand *<FOO>[<i>]<TEXT>
User command to define
FOO
to be a macro withi
arguments (i
= 0 if missing)
having the definition<TEXT>
. Produces an error ifFOO
already defined.
Normally the command is defined to belong
(i.e. it may take multiple paragraphs in its argument). In the star-form, the command is not defined aslong
and a blank line in any argument to the command would generate an error.
If you define a command with at least one argument (i
> 0), you can specify an additional (optional) argument before the definition <TEXT>
. This optional argument will be used as the "default" value for a first optional argument to FOO
.
So, as an example, consider
newcommandFOO[2]<TEXT>
This command has two mandatory arguments and is therefore used as FOO<one><two>
. However,
newcommandFOO[2][X]<TEXT>
takes two (2
) arguments, the first of which is optional and has a default of X
(if not supplied). You can use it as FOO<one>
(which is equivalent to FOO[X]<one>
) or FOO[<one>]<two>
. Similarly,
newcommandFOO[1][X]<TEXT>
takes a single (1
) optional argument that has a default value of X
(if not supplied) and can be used as FOO
(which is equivalent to FOO[X]
) or FOO[<one>]
.
In your particular case,
newcommand*name[1][C]<TEXT>
defines name
to (be non-long
; that is, <TEXT>
cannot have blank lines and) take a single (1
) optional argument that defaults to C
if not supplied. You can use it as name
(which is equivalent to name[C]
) or name[<one>]
.
Reference:
LaTeX2e sources
What do
newcommand
,renewcommand
, andprovidecommand
do, and how do they differ?What is the difference between
def
andnewcommand
?
LaTeX's newcommand
has the following syntax:
newcommand *<FOO>[<i>]<TEXT>
User command to define
FOO
to be a macro withi
arguments (i
= 0 if missing)
having the definition<TEXT>
. Produces an error ifFOO
already defined.
Normally the command is defined to belong
(i.e. it may take multiple paragraphs in its argument). In the star-form, the command is not defined aslong
and a blank line in any argument to the command would generate an error.
If you define a command with at least one argument (i
> 0), you can specify an additional (optional) argument before the definition <TEXT>
. This optional argument will be used as the "default" value for a first optional argument to FOO
.
So, as an example, consider
newcommandFOO[2]<TEXT>
This command has two mandatory arguments and is therefore used as FOO<one><two>
. However,
newcommandFOO[2][X]<TEXT>
takes two (2
) arguments, the first of which is optional and has a default of X
(if not supplied). You can use it as FOO<one>
(which is equivalent to FOO[X]<one>
) or FOO[<one>]<two>
. Similarly,
newcommandFOO[1][X]<TEXT>
takes a single (1
) optional argument that has a default value of X
(if not supplied) and can be used as FOO
(which is equivalent to FOO[X]
) or FOO[<one>]
.
In your particular case,
newcommand*name[1][C]<TEXT>
defines name
to (be non-long
; that is, <TEXT>
cannot have blank lines and) take a single (1
) optional argument that defaults to C
if not supplied. You can use it as name
(which is equivalent to name[C]
) or name[<one>]
.
Reference:
LaTeX2e sources
What do
newcommand
,renewcommand
, andprovidecommand
do, and how do they differ?What is the difference between
def
andnewcommand
?
answered Jan 21 at 6:21
WernerWerner
443k679781675
443k679781675
add a comment |
add a comment |
2
Welcome to TeX.SE! This means in this case that
name
has one optional argument whose default value isC
.– marmot
Jan 21 at 3:30
latexref.xyz/…
– Henri Menke
Jan 21 at 3:39
@HenriMenke Is there a more modern link in which things like
it
do not get advertized?– marmot
Jan 21 at 3:54
@marmot Well,
it
etc. are commands provided by the standard LaTeX classes, so naturally they would be listed in a reference manual. However, you can contribute and remove them latexref.xyz/dev/writing.html– Henri Menke
Jan 21 at 4:08
@HenriMenke Please don't get me wrong, this was not meant to criticize you. I have just seen so many cases in which users, especially new users, got interesting comments when they were using
it
and so on. Therefore I am really wondering if there are sources of the same information which a free of such relics.– marmot
Jan 21 at 4:13