The symbols _ (underscore)and ^ (hat) can also be used to write superscripts and subscripts, respectively.

Here is an example:

\[ a_1^2 + a_2^2 = a_3^2 \]

The above LaTex code will produce the following output:

a_{1}^{2}+a_{2}^{2}=a_{3}^{2}