我需要一种方法,使我在列表中放置的逃逸字符串是正确的。
line of code
line of code
line of code
\vdots correctly aligned escaped string
我拥有的就是
line of code
line of code
line of code
\vdots right aligned escaped string
真正的代码是:
\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)
{
listView1.Items.Add("xd"+index);
index++;
listView1.Items[listView1.Items.Count - 1].Selected = true;
(*@ $\vdots$ @*)
(*@ $\vdots$ Comparaciones similares a la anterior. Compactadas por brevedad. @*)
(*@ $\vdots$ @*)
}
答案1
我无法通过以下最小示例重现您所看到的内容(尽管框架上的换行符很奇怪)。您使用的另一个包可能是导致该问题的原因。
\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)
{
listView1.Items.Add("xd"+index);
index++;
listView1.Items[listView1.Items.Count - 1].Selected = true;
(*@ $\vdots$ @*)
(*@ $\vdots$ Comparaciones similares a la anterior. Compactadas por brevedad. @*)
(*@ $\vdots$ @*)
}
\end{lstlisting}
\end{document}