How to eliminate the border discontinuity in lstlisting

705 views Asked by At

I'm trying to use lstlistings package with pdflatex. I write a demo but get a bad effect as the border is discontinuity.

I used some Chinese character, so I have to use escape character(I'm going to set it '~').

Now I can see Chinese character, but the border is discontinuity and sometimes get incorrect line feed.

This My Code :

\documentclass{article}
\usepackage[UTF8]{ctex}
\usepackage{listings}

\lstset{
    escapeinside={~~},
    basicstyle=\zihao{5}\ttfamily,
    columns=flexible,
    breaklines=true,
    frame=single,
}

\begin{document}
\begin{lstlisting}[caption={登录}]
Request(`/students/student?id=\$\{stdId\}`,\ model,\ "student",\ \{\});  //~同步获取学生id~

nodom.request(`/students/semester?id=\$\{stdId\}`).then(data\ =>\{ //~获取当前学期~

let\ semester =\ JSON.parse(data);

model.set("semester",\ semester);

let\ \{semesterId=null\}\ =\ \{...semester\};

let\ url\ =\ `/students/questions\_overview?semId=\$\{semesterId\}\&stuId=\$\{stdId\}`;

Request(url,\ model,\ "problems",\ \{\},\ RefreshTimeleft);  //`~获取学生考试的题目和回答情况~ \});

model.set("intervalObj",\ setInterval(RefreshTimeleft(model)),\ 1000)); //~定时刷新剩余时间定时刷余时间定时剩间~
\end{lstlisting}

    
\end{document}

This is the output: enter image description here

0

There are 0 answers