# LaTeX/Packages/Listings and subindex

I am using LaTeX/Packages/Listings AND this code to make a rectangle with sql source code inside of it, but I would like to have the option to insert subindexes...

I try it using the following but had no success, any idea?

\lstset{language=SQL, caption=SQL, label=SQL, frame=shadowbox, rulesepcolor=\color{blue}}
\begin{lstlisting}
SELECT  SUM($x_{1}$ *$x_{1}$ FROM X;
\end{lstlisting}


I would like to make the $x_1$ shows right

-
I think you need to add mathescape=true. –  Peter Grill Nov 20 '11 at 20:01

You need to add mathescape=true. Here is the output without and with this added:

\documentclass[border=2pt]{standalone}
\usepackage{xcolor}
\usepackage{listings}

\begin{document}
SELECT  SUM($x_{1}$ *$x_{1}$ FROM X;
SELECT  SUM($x_{1}$ *$x_{1}$ FROM X;

One more question, Is it possible to change the title "Listing 1", "Listing 2".... "Listing n"? to a different title? –  cMinor Nov 20 '11 at 20:08
@cMinor \renewcommand{\lstlistingname}{Code} will change Listing n to Code n. –  Torbjørn T. Nov 20 '11 at 20:21