开发者

How to uniform background on listing (LaTeX)?

When I put a snippet on a listing, and chage background to gray, each character's background remains in white. How to avoid it, and show all background in gray?

My LaTeX code is:

\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}  
\lstset{  
language=Java,  
tabsize=4,  
basics开发者_C百科tyle=\ttfamily,  
backgroundcolor=\color{lbcolor},  
showstringspaces=false  
}

Thanks a lot.


I'm not sure how you do the listing, but you can try with lstlisting, the following shoud work:

\documentclass[11pt]{article}
\usepackage{listings}
\usepackage{color}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}  
\begin{document}
\lstset{  
language=Java,  
tabsize=4,  
basicstyle=\ttfamily,  
backgroundcolor=\color{lbcolor},  
showstringspaces=false  
}
\begin{lstlisting}
Code
Code
Code
\end{lstlisting}
\end{document}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜