zoukankan      html  css  js  c++  java
  • Mac, Linux中统一配置Latex中文字体

    对于中文的latex文档,在Linux下一般可以使用系统自带的开源字体:文泉驿(WenQuanYi)来实现,即如下的最小例子,通过xelatex命令来编译即可生成中文文档。

    documentclass[UTF8,nofonts]{ctexart}
    usepackage{xeCJK}
    	itle{中文测试}
    author{测试}
    date{	oday}
    % use buildin Chinese font in linux
    setCJKmainfont[BoldFont={WenQuanYi Micro Hei/Bold}]{WenQuanYi Micro Hei}
    egin{document}large
    section{中文}
    中文测试,中文测试,中文测试。
    end{document}
    

    而在Mac下并没有文泉驿字体,但是却有其它的中文字体,有没有同时兼容Linux和Mac,而且不用安装额外字体的解决方案呢?
    从网上搜到了解决方法,更换为通用的字体即可[1](可叹的是,给出解决方案的竟然是老外,国内的百度没搜到有用的解决方案):

    documentclass[UTF8,nofonts]{ctexart}
    usepackage{xeCJK}
    	itle{中文测试}
    author{测试}
    date{	oday}
    % use buildin Chinese font in linux and Mac
    setCJKmainfont[BoldFont=FandolSong-Bold.otf,ItalicFont=FandolKai-Regular.otf]{FandolSong-Regular.otf}
    setCJKsansfont[BoldFont=FandolHei-Bold.otf]{FandolHei-Regular.otf}
    setCJKmonofont{FandolFang-Regular.otf}
    egin{document}large
    section{中文}
    中文测试,中文测试,中文测试。
    end{document}
    

    经过测试,这种设置在Linux Fedora25的英文环境也可以通过编译,成功生成中文的pdf文档。

    参考:
    [1]https://tex.stackexchange.com/questions/215564/what-chinese-fonts-can-i-rely-on-to-be-in-mac-and-linux

  • 相关阅读:
    P4999 烦人的数学作业
    P3413 SAC#1
    P2657 [SCOI2009]windy数
    P2602 [ZJOI2010]数字计数
    JSOI2007 建筑抢修
    CF161B Discounts
    Description
    Street Numbers
    Pizza Cutting
    Supermean
  • 原文地址:https://www.cnblogs.com/docnan/p/7081500.html
Copyright © 2011-2022 走看看