MacTeX 下设置 CTeX 默认中文字体

来源:互联网 发布:王珊 数据库 编辑:程序博客网 时间:2024/04/27 13:28

1. 遇到问题

这回找到一些report/thesis/开题报告的模版,主要是中文的。

Why can’t I compile the simplest TeX file of only 6 lines?

This combination of packages is attempting to load the xeCJK package twice: once on line 11 of ctex-xecjk-engine.def from the ctex package, and then again on line 43 of xeCJK-listings.sty from the listings package. The clash you are getting is that the options are different in each case (the first one specifies [BoldFont,normalindentfirst] while the second gives no options).

始终遇到如下错误


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "[SIMKAI.TTF]" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

看起来是个很普遍的错误,

  • Solution to “[SIMKAI.TTF] cannot be found” error
  • texlive2013升级为texlive2014后中文字体问题
  • 安装TeX及中文支持

解决方法也很一致:

  • 修改/usr/local/texlive/2013/texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def 文件,把其中的 [SIMKAI.TTF] , [SIMFANG.TTF] 改成KaiTi, FangSong就可以了

结果怎么都不行!!

2. What happened???

显然在TexLive 2012之前用的是以上字体名字。
MacTeX 下设置 CTeX 默认中文字体就用的正确的字体变量名。

  • 修改/usr/local/texlive/2013/texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def 文件,把其中的 [SIMKAI.TTF] , [SIMFANG.TTF] 改成STKaiti, STFangsong就可以了

3. 扩充阅读

在Mac下使用LaTeX的中文字体 提到了Mac下的 系统的“字体册”,英文版叫Font Book。但并不是照文章里说的用 “PostScript名字” 就可以了!!

要找到真正的变量名,要用fc-list,比如MacTex 2010 XeLatex中文支持,然后找类似 STKaiti:style=regular 的字串!!
比如在我的机器上(TexLive2014, ML 10.9.5), 普通宋体既不是Songti,也不是STSongti,而是STSong,坑爹啊~~~
当上面的文章又说 因此需将"[SIMKAI.TTF]"改为“KaiTi_GB2312” ,而且 适用于MacTex 2013和MacTex 2014 — 偶滴神啊~~~

4. 完整学习

有空还是完整学习一下CTex的知识

  • CTEX : HomePage
  • TeX 基本知识 对了解整个TeX的历史和各个包的区别/作用也很有帮助
0 0
原创粉丝点击