代码改变世界

latex 显示中文

2015-05-21 08:44  zhaoyang10  阅读(907)  评论(0编辑  收藏  举报

中文支持需要cjk-latex,总得来说中文可以使用GB和GBK两种字体,GBK需要从windows下copy *.ttc或*.ttf, GB字体则在linux下就用。
  
  先说支持GB的中文显示,安装以下deb包:
   apt-get install cjk-latex tetex-extra tetex-doc tfm-arphic-gbsn00lp tfm-arphic-gkai00mp ttf-arphic-gbsn00lp ttf-arphic-gkai00mp ,
  编辑tex源文件sample.tex
  coosbay:~/tex# cat sample.tex
  \documentclass{article}
  \begin{document}
  \begin{CJK*}{GB}{song}
  显示中文
  \end{CJK*}{GB}{song}
  \end{document}
  
  接下来只需要latex sample.tex; dvipdfm sample.dvi就可以生成sample.pdf文件了。GB支持{song}和{kai}两种字体。
  
  如果需要支持GBK字体文件,则需要安装texmf-zh (这个包在ustc目录里,包括install-gbkfonts,update-gbkfonts,remove-gbkfonts 三个命令)