Function Repository Resource:

# SymbolToSubscript (1.1.0)current version: 3.0.0 »

Convert symbols into subscript forms

Contributed by: E. Chan-López & Jaime Manuel Cabrera
 ResourceFunction["SymbolToSubscript"][expr] gives the representation with subscripts for one or more unprotected symbols expr.

## Details

ResourceFunction["SymbolToSubscript"] does not act on numbers, it just returns them.
ResourceFunction["SymbolToSubscript"] does not act on symbols that already have subscripts, it just returns them.
ResourceFunction["SymbolToSubscript"] does not act on protected heads of functions.
SymbolToSubscripts can be used on symbolic matrices, where it separates numbers with commas.
SymbolToSubscripts[expr,"ToStringFormat" ] can be used to get the string format of expressions.

## Examples

### Basic Examples (2)

Use SymbolToSubscript with an unprotected symbol:

 In[1]:=
 Out[1]=

Use SymbolToSubscript with a list of unprotected symbols:

 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

### Scope (9)

Use SymbolToSubscript with a list of functions with protected heads:

 In[5]:=
 Out[5]=

Use SymbolToSubscript with the default form for the ith constant C[i]:

 In[6]:=
 Out[6]=

Use SymbolToSubscript with symbolic matrix:

 In[7]:=
 Out[8]=

Use SymbolToSubscript with tensor of rank 3:

 In[9]:=
 Out[9]=

Use SymbolToSubscript with tensor of rank 4:

 In[10]:=
 Out[10]=

If the expression contains symbols with a capital C, the format for the other indexed symbols is the same as ith constant C[i]:

 In[11]:=
 Out[11]=

Use SymbolToSubscript with a nonlinear system of ordinary differential equations:

 In[12]:=
 Out[12]=

Use SymbolToSubscript with a system of partial differential equations:

 In[13]:=
 Out[13]=

Both the base and subscript in the output are symbols and inherit any existing definitions:

 In[14]:=
 In[15]:=
 Out[15]=

### Applications (3)

Format a symbolic polynomial:

 In[16]:=
 In[17]:=
 Out[17]=

Format a symbolic matrix:

 In[18]:=
 In[19]:=
 Out[19]=
 In[20]:=
 Out[20]=

Use SymbolToSubscript and TeXForm:

 In[21]:=
 Out[21]=

Define a function for making a Vandermonde matrix:

 In[22]:=

Format a Vandermonde matrix:

 In[23]:=
 Out[23]=

The SymbolToSubscript command allows TeXForm to be used correctly when we have expressions with subscripts that are written as symbols:

 In[24]:=
 Out[24]=
 In[25]:=
 Out[25]=
 In[26]:=
 Out[26]=
 In[27]:=
 Out[27]=
 In[28]:=
 Out[28]=

### Properties and Relations (2)

Use SymbolToSubscript with the resource function HurwitzMatrix:

 In[29]:=
 In[30]:=
 Out[31]=
 In[32]:=
 Out[32]=

Use SymbolToSubscript with the resource function SolutionRulesToFunctions:

 In[33]:=
 Out[33]=

### Possible Issues (2)

Before getting the subscript format, SymbolToSubscript separates the expression x1y2 as {“x”,“1y2”}, and then passes each part to input form using ToExpression. Therefore, with the expression x1y2 we get xy2 instead x1y2:

 In[34]:=
 Out[34]=

To handle the above problem, SymbolToSubscript has the ToStringFormat option:

 In[35]:=
 Out[35]=
 In[36]:=
 Out[36]=

## Publisher

Ramón Eduardo Chan López

## Version History

• 3.0.0 – 09 August 2023
• 2.0.0 – 26 June 2023
• 1.1.0 – 22 August 2022
• 1.0.0 – 19 July 2022