Special Characters

Built into Mathematica are a large number of special characters intended for use in mathematical and other notation. "Listing of Named Characters" gives a complete listing.

Each special character is assigned a full name such as \[Infinity]. More common special characters are also assigned aliases, such as EscinfEsc. You can set up additional aliases using the InputAliases notebook option discussed in "Options for Expression Input and Output".

For special characters that are supported in standard dialects of TeX, Mathematica also allows you to use aliases based on TeX names. Thus, for example, you can enter \[Infinity] using the alias Esc\inftyEsc. Mathematica also supports aliases such as EscEsc based on names used in SGML and HTML.

Standard system software on many computer systems also supports special key combinations for entering certain special characters. On a Macintosh, for example, Option+5 will produce in most fonts. With the notebook front end Mathematica automatically allows you to use special key combinations when these are available, and with a text-based interface you can get Mathematica to accept such key combinations if you set an appropriate value for $CharacterEncoding.

• Use a full name such as \[Infinity]
• Use an alias such as EscinfEsc
• Use a TeX alias such as Esc\inftyEsc
• Use an SGML or HTML alias such as EscEsc
• Click a button in a palette
• Use a special key combination supported by your computer system

Ways to enter special characters.

In a Mathematica notebook, you can use special characters just like you use standard keyboard characters. You can include special characters both in ordinary text and in input that you intend to give to Mathematica.

Some special characters are set up to have an immediate meaning to Mathematica. Thus, for example, is taken to be the symbol Pi. Similarly, is taken to be the operator , while is equivalent to the function Union.

and have immediate meanings in Mathematica.
In[1]:=
Click for copyable input
Out[1]=
or \[Union] is immediately interpreted as the Union function.
In[2]:=
Click for copyable input
Out[2]=
or \[SquareUnion] has no immediate meaning to Mathematica.
In[3]:=
Click for copyable input
Out[3]=

Among ordinary characters such as E and , some have an immediate meaning to Mathematica, but most do not. And the same is true of special characters.

Thus, for example, while and have an immediate meaning to Mathematica, and do not.

This allows you to set up your own definitions for and .

has no immediate meaning in Mathematica.
In[4]:=
Click for copyable input
Out[4]=
This defines a meaning for .
In[5]:=
Click for copyable input
Now Mathematica evaluates just as it would any other function.
In[6]:=
Click for copyable input
Out[6]=

Characters such as and are treated by Mathematica as letters—just like ordinary keyboard letters like or .

But characters such as and are treated by Mathematica as operators. And although these particular characters are not assigned any built-in meaning by Mathematica, they are nevertheless required to follow a definite syntax.

is an infix operator.
In[7]:=
Click for copyable input
Out[7]=
The definition assigns a meaning to the operator.
In[8]:=
Click for copyable input
Now can be evaluated by Mathematica.
In[9]:=
Click for copyable input
Out[9]=

The details of how input you give to Mathematica is interpreted depends on whether you are using StandardForm or TraditionalForm, and on what additional information you supply in InterpretationBox and similar constructs.

But unless you explicitly override its built-in rules by giving your own definitions for MakeExpression, Mathematica will always assign the same basic syntactic properties to any particular special character.

These properties not only affect the interpretation of the special characters in Mathematica input, but also determine the structure of expressions built with these special characters. They also affect various aspects of formatting; operators, for example, have extra space left around them, while letters do not.

Lettersa, E, , , , etc.
Letter-like forms, , , , etc.
Operators, , , , etc.

Types of special characters.

In using special characters, it is important to make sure that you have the correct character for a particular purpose. There are quite a few examples of characters that look similar, yet are in fact quite different.

A common issue is operators whose forms are derived from letters. An example is or \[Sum], which looks very similar to or \[CapitalSigma].

As is typical, however, the operator form is slightly less elaborate and more stylized than the letter form . In addition, is an extensible character which grows depending on the summand, while has a size determined only by the current font.

Different characters that look similar.

In cases such as \[CapitalAlpha] versus , both characters are letters. However, Mathematica treats these characters as different, and in some fonts, for example, they may look quite different.

The result contains four distinct characters.
In[10]:=
Click for copyable input
Out[10]=

Traditional mathematical notation occasionally uses ordinary letters as operators. An example is the in a differential such as that appears in an integral.

To make Mathematica have a precise and consistent syntax, it is necessary at least in StandardForm to distinguish between an ordinary and the used as a differential operator.

The way Mathematica does this is to use a special character or \[DifferentialD] as the differential operator. This special character can be entered using the alias EscddEsc.

Mathematica uses a special character for the differential operator, so there is no conflict with an ordinary .
In[11]:=
Click for copyable input
Out[11]=

When letters and letter-like forms appear in Mathematica input, they are typically treated as names of symbols. But when operators appear, functions must be constructed that correspond to these operators. In almost all cases, what Mathematica does is to create a function whose name is the full name of the special character that appears as the operator.

Mathematica constructs a CirclePlus function to correspond to the operator , whose full name is \[CirclePlus].
In[12]:=
Click for copyable input
Out[12]//FullForm=
This constructs an And function, which happens to have built-in evaluation rules in Mathematica.
In[13]:=
Click for copyable input
Out[13]//FullForm=

Following the correspondence between operator names and function names, special characters such as that represent built-in Mathematica functions have names that correspond to those functions. Thus, for example, is named \[Divide] to correspond to the built-in Mathematica function Divide, and is named \[Implies] to correspond to the built-in function Implies.

In general, however, special characters in Mathematica are given names that are as generic as possible, so as not to prejudice different uses. Most often, characters are thus named mainly according to their appearance. The character is therefore named \[CirclePlus], rather than, say , and is named \[TildeTilde] rather than, say, .

Different operator characters that look similar.

There are sometimes characters that look similar but which are used to represent different operators. An example is \[Times] and \[Cross]. \[Times] corresponds to the ordinary Times function for multiplication; \[Cross] corresponds to the Cross function for vector cross products. The for \[Cross] is drawn slightly smaller than for \[Times], corresponding to usual careful usage in mathematical typography.

The \[Times] operator represents ordinary multiplication.
In[14]:=
Click for copyable input
Out[14]=
The \[Cross] operator represents vector cross products.
In[15]:=
Click for copyable input
Out[15]=
The two operators display in a similar way—with \[Times] slightly larger than \[Cross].
In[16]:=
Click for copyable input
Out[16]=

In the example of \[And] and \[Wedge], the \[And] operator—which happens to be drawn slightly larger—corresponds to the built-in Mathematica function And, while the \[Wedge] operator has a generic name based on the appearance of the character and has no built-in meaning.

You can mix \[Wedge] and \[And] operators. Each has a definite precedence.
In[17]:=
Click for copyable input
Out[17]//FullForm=

Some of the special characters commonly used as operators in mathematical notation look similar to ordinary keyboard characters. Thus, for example, or \[Wedge] looks similar to the character on a standard keyboard.

Mathematica interprets a raw as a power. But it interprets as a generic Wedge function. In cases such as this where there is a special character that looks similar to an ordinary keyboard character, the convention is to use the ordinary keyboard character as the alias for the special character. Thus, for example, Esc^Esc is the alias for \[Wedge].

The raw is interpreted as a power, but the Esc^Esc is a generic wedge operator.
In[18]:=
Click for copyable input
Out[18]=

A related convention is that when a special character is used to represent an operator that can be typed using ordinary keyboard characters, those characters are used in the alias for the special character. Thus, for example, Esc->Esc is the alias for or \[Rule], while Esc&&Esc is the alias for or \[And].

Esc->Esc is the alias for \[Rule], and Esc&&Esc for \[And].
In[19]:=
Click for copyable input
Out[19]//FullForm=

The most extreme case of characters that look alike but work differently occurs with vertical bars.

form
character name
alias
interpretation
x|y|Alternatives[x,y]
xy\[VerticalSeparator]Esc|EscVerticalSeparator[x,y]
x|y\[VerticalBar]Esc|EscVerticalBar[x,y]
x\[LeftBracketingBar]Escl|EscBracketingBar[x]
\[RightBracketingBar]Escr|Esc

Different types of vertical bars.

Notice that the alias for \[VerticalBar] is Esc|Esc, while the alias for the somewhat more common \[VerticalSeparator] is Esc|Esc. Mathematica often gives similar-looking characters similar aliases; it is a general convention that the aliases for the less commonly used characters are distinguished by having spaces at the beginning.

EscnnnEscbuilt-in alias for a common character
EscnnnEscbuilt-in alias for similar but less common character
Esc.nnnEscalias globally defined in a Mathematica session
Esc,nnnEscalias defined in a specific notebook

Conventions for special character aliases.

The notebook front end for Mathematica often allows you to set up your own aliases for special characters. If you want to, you can overwrite the built-in aliases. But the convention is to use aliases that begin with a dot or comma.

Note that whatever aliases you may use to enter special characters, the full names of the characters will always be used when the characters are stored in files.

New to Mathematica? Find your learning path »
Have a question? Ask support »