转自    http://blog.csdn.net/lydyangliu/article/details/9208635

\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{listings}
\lstset{%
alsolanguage=Java,
%language={[ISO]C++}, %language为,还有{[Visual]C++}
%alsolanguage=[ANSI]C, %可以添加很多个alsolanguage,如alsolanguage=matlab,alsolanguage=VHDL等
%alsolanguage= tcl,
alsolanguage= XML,
tabsize=4, %
frame=shadowbox, %把代码用带有阴影的框圈起来
commentstyle=\color{red!50!green!50!blue!50},%浅灰色的注释
rulesepcolor=\color{red!20!green!20!blue!20},%代码块边框为淡青色
keywordstyle=\color{blue!90}\bfseries, %代码关键字的颜色为蓝色,粗体
showstringspaces=false,%不显示代码字符串中间的空格标记
stringstyle=\ttfamily, % 代码字符串的特殊格式
keepspaces=true, %
breakindent=22pt, %
numbers=left,%左侧显示行号 往左靠,还可以为right,或none,即不加行号
stepnumber=1,%若设置为2,则显示行号为1,3,5,即stepnumber为公差,默认stepnumber=1
%numberstyle=\tiny, %行号字体用小号
numberstyle={\color[RGB]{0,192,192}\tiny} ,%设置行号的大小,大小有tiny,scriptsize,footnotesize,small,normalsize,large等
numbersep=8pt, %设置行号与代码的距离,默认是5pt
basicstyle=\footnotesize, % 这句设置代码的大小
showspaces=false, %
flexiblecolumns=true, %
breaklines=true, %对过长的代码自动换行
breakautoindent=true,%
breakindent=4em, %
escapebegin=\begin{CJK*}{GBK}{hei},escapeend=\end{CJK*},
aboveskip=1em, %代码块边框
tabsize=2,
showstringspaces=false, %不显示字符串中的空格
backgroundcolor=\color[RGB]{245,245,244}, %代码背景色
%backgroundcolor=\color[rgb]{0.91,0.91,0.91} %添加背景色
escapeinside=``, %在``里显示中文
%% added by http://bbs.ctex.org/viewthread.php?tid=53451
fontadjust,
captionpos=t,
framextopmargin=2pt,framexbottommargin=2pt,abovecaptionskip=-3pt,belowcaptionskip=3pt,
xleftmargin=4em,xrightmargin=4em, % 设定listing左右的空白
texcl=true,
% 设定中文冲突,断行,列模式,数学环境输入,listing数字的样式
extendedchars=false,columns=flexible,mathescape=true
% numbersep=-1em
}
\begin{document}

最新文章

  1. Java8 jvm参数
  2. POJ3279 Fliptile(暴力)
  3. C语言 文件操作6--文件打开方式详解
  4. 20145303 20145339 《信息安全系统设计基础》 实验五 简单嵌入式WEB服务器实验
  5. codeforces A. Xenia and Divisors 解题报告
  6. CSDN帐号被盗尚未?
  7. Git 常用命令 更新与提交
  8. juniper防护墙接口的NAT和ROUTE模式如何选择问题
  9. postgres-xl 集体搭建(2)
  10. 老李分享:Mac快捷键
  11. 使用Socket对序列化数据进行传输(基于C#)
  12. JQuery实现数组移除指定元素
  13. 学习笔记之Python Crash Course
  14. 第一次项目上Linux服务器(二:——安装jdk)
  15. dp练习(5)——最长严格上升子序列
  16. 【bzoj1096】[ZJOI2007]仓库建设 斜率优化dp
  17. 数据库连接dbcp$c3p0
  18. rhel yum报错
  19. angularJS笔记之过滤器
  20. [转] javascript另类方法高效实现htmlencode()与htmldecode()函数

热门文章

  1. 【LeetCode题解】二叉树的遍历
  2. 使用SpringMvc调用POI jar导出excel的源码
  3. webservice_模拟报文测试
  4. 笑谈ArcToolbox (3) ArcToolbox的一亩三分地
  5. for语句输出图形
  6. QQ18年,解密8亿月活的QQ后台服务接口隔离技术
  7. (原)SQL Server 系统提供功能的三个疑惑
  8. foreach和for循环的区别
  9. Swift 2.2 最基本的多线程
  10. 小米wifi局域网下播放硬盘影片使用方法