# What is this \newcommand argument? [duplicate]

\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.

## marked as duplicate by Alan Munn, Stefan Pinnow, Kurt, Henri Menke, Andrew SwannJan 21 at 8:18

• 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
• @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

LaTeX's \newcommand has the following syntax:

\newcommand *{<\FOO>}[<i>]{<TEXT>}


User command to define \FOO to be a macro with i arguments (i = 0 if missing) having the definition <TEXT>. Produces an error if \FOO already defined. Normally the command is defined to be \long (i.e. it may take multiple paragraphs in its argument). In the star-form, the command is not defined as \long 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

\newcommand{\FOO}[2]{<TEXT>}


This command has two mandatory arguments and is therefore used as \FOO{<one>}{<two>}. However,

\newcommand{\FOO}[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,

\newcommand{\FOO}[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>].

\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>].