# Align normal text inside a listing

I need a way to correctly align the escaped strings that I put inside of this listing. The problem is that they are presented right aligned. I want that this lines keep the indentation of the previous code. For example:

 line of code
line of code
line of code
\vdots correctly aligned escaped string


what I have is something like

 line of code
line of code
line of code
\vdots right aligned escaped string


the real code is this:

\lstset{language=[Sharp]C,,basicstyle=\footnotesize, showspaces=false,showtabs=false,,breaklines=true,showstringspaces=false,breakatwhitespace=true,frame=trBL, escapeinside={(*@}{@*)}}
\begin{lstlisting}
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
string oldName;
int index = 0;
public Form1()
{
InitializeComponent();
listView1.LabelEdit = true;
listView1.MultiSelect = false;
}

private void button1_Click(object sender, EventArgs e)
{
index++;
listView1.Items[listView1.Items.Count - 1].Selected = true;
(*@  $\vdots$ @*)
(*@  $\vdots$ Comparaciones similares a la anterior. Compactadas por brevedad. @*)
(*@  $\vdots$ @*)

}

-
While it is good that you include some code, it is much better to include a minimal working example---a complete chunk of code that can be copied and compiled and which exhibits your issue whilst containing nothing not needed to do so. –  vanden May 15 '11 at 14:19
add the documentclass and begin{document} and end{document} to the code that i expose. –  mjsr May 15 '11 at 14:26
Yes, I and everyone else who might try to help you could each take a few seconds to do that. Or, you, the person seeking help, could take a few seconds to do that for all of those who might help you. One alternative is both much more efficient and polite. –  vanden May 15 '11 at 16:50

I can't reproduce what you're seeing with the following minimal example (though the line breaks on the frame are weird). There's probably another package you're using that's causing the problem.

\documentclass{article}
\usepackage{listings}
\begin{document}
\lstset{language=[Sharp]C,,basicstyle=\footnotesize, showspaces=false,showtabs=false,,breaklines=true,showstringspaces=false,breakatwhitespace=true,frame=trBL, escapeinside={(*@}{@*)}}
\begin{lstlisting}
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
string oldName;
int index = 0;
public Form1()
{
InitializeComponent();
listView1.LabelEdit = true;
listView1.MultiSelect = false;
}

private void button1_Click(object sender, EventArgs e)
{
index++;
listView1.Items[listView1.Items.Count - 1].Selected = true;
(*@  $\vdots$ @*)
(*@  $\vdots$ Comparaciones similares a la anterior. Compactadas por brevedad. @*)
(*@  $\vdots$ @*)

}
\end{lstlisting}
\end{document}


-
you are right the problem with the alignment was with the tabs characters. I don't know why but if i use tabs instead of spaces i get the bad result, i.e the text right aligned, if i use spaces then i get the result that you expose. Weird thing. Can you give me some hints to avoid break the external box? –  mjsr May 15 '11 at 14:38