LaTeX中listings 1.3与CJK冲突的问题及解决方法

  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid/gid is 1400/1400 is not allowed to access /tmp owned by uid/gid 0/0 in /home/wangxum1/public_html/site/includes/file.inc on line 190.
  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid/gid is 1400/1400 is not allowed to access /tmp owned by uid/gid 0/0 in /home/wangxum1/public_html/site/includes/file.inc on line 190.

这实际不算是一个bug。
对于一直用listings的人来说,从 1.2 升级到 1.3 的时候可能会遇到编译错误,具体的讲就是: 当listings所插入的内容跨过一页,而页脚/页眉中有中文的时候会发生编译错误。
Listings 和中文的兼容性本来就比较一般,有两种解决方案

  1. 换用 cjk 4.6.0 并使用 utf-8 编码
  2. 在使用listings之前使用命令\lstset{extendedchars=false}

两者均可完成所需功能。