MATHEMATICA TUTORIAL

Special Characters

In addition to the ordinary characters that appear on a standard keyboard, you can include in Mathematica strings any of the special characters that are supported by Mathematica.

Here is a string containing special characters.
In[1]:=
Click for copyable input
Out[1]=
You can manipulate this string just as you would any other.
In[2]:=
Click for copyable input
Out[2]=
Here is the list of the characters in the string.
In[3]:=
Click for copyable input
Out[3]=

In a Mathematica notebook, a special character such as can always be displayed directly. But if you use a text-based interface, then typically the only characters that can readily be displayed are the ones that appear on your keyboard.

As a result, what Mathematica does in such situations is to try to approximate special characters by similar-looking sequences of ordinary characters. And when this is not practical, Mathematica just gives the full name of the special character.

In a Mathematica notebook using StandardForm, special characters can be displayed directly.
In[4]:=
Click for copyable input
Out[4]=
In OutputForm, however, the special characters are approximated when possible by sequences of ordinary ones.
In[5]:=
Click for copyable input
Out[5]//OutputForm=

Mathematica always uses full names for special characters in InputForm. This means that when special characters are written out to files or external programs, they are by default represented purely as sequences of ordinary characters.

This uniform representation is crucial in allowing special characters in Mathematica to be used in a way that does not depend on the details of particular computer systems.

In InputForm the full names of all special characters are always written out explicitly.
In[6]:=
Click for copyable input
Out[6]//InputForm=
aa literal character
\[Name]a character specified using its full name
a to be included in a string
a to be included in a string

Ways to enter characters in a string.

You have to use to "escape" any or characters in strings that you enter.
In[7]:=
Click for copyable input
Out[7]=
produces a literal rather than forming part of the specification of .
In[8]:=
Click for copyable input
Out[8]=
This breaks the string into a list of individual characters.
In[9]:=
Click for copyable input
Out[9]=
This creates a list of the characters in the full name of .
In[10]:=
Click for copyable input
Out[10]=
And this produces a string consisting of an actual from its full name.
In[11]:=
Click for copyable input
Out[11]=
New to Mathematica? Find your learning path »
Have a question? Ask support »