TheNetAdmin / zjuthesis

Zhejiang University Graduation Thesis LaTeX Template
https://thenetadmin.github.io/zjuthesis
MIT License
2.49k stars 597 forks source link

macOS本地编译乱码,中文不显示 #383

Closed cxzhou35 closed 1 month ago

cxzhou35 commented 4 months ago

操作系统

MacOS

TeX 套件

TeXLive 2021 或更新的版本

TeX Compiler

XeTeX

zjuthesis 版本号

v10.0.1

MajorFormat

general

Degree

undergraduate

Type

thesis

Period

proposal

BlindReview

false

GradLevel

master

问题描述

  1. 修改了模板内的 ./config/format/general/fonts.tex

  2. 使用 xelatex 编译,tex版本见下图

    image
  3. 遇到了字体缺失的问题,中文无法显示 image

编译日志

zjuthesis.log

代码

./config/format/general/fonts.tex 现在的代码:

\newcommand{\FakeBoldSize}{4}

% NOTE:
%   To use LuaTeX, we manually set the AutoFakeBold size for each font,
%   because in LuaTeX, CTeX invokes luatexja which does not recognize a global
%   AutoFakeBold setting. So we need to set AutoFakeBold for each font.

% ctex package stores one of "windows", "mac", and "fandol" in \g__ctex_fontset_tl
\ifthenelse{\equal{\csname g__ctex_fontset_tl\endcsname}{mac}}
{
    \IfFileExists{ /System/Library/Fonts/PingFang.ttc }
    {
        % MacOS El Capitan and later version
        % https://github.com/CTeX-org/ctex-kit/issues/351

        % Fonts
        %   Fix songti font invocation in `ctex` package on MacOS old version, to enable bold font
        %   Detailes in: https://github.com/TheNetAdmin/zjuthesis/issues/48
        %   Similar implementation: https://github.com/xueruini/thuthesis/blob/a86b0824da527268645571cc5fe3096d65a665b3/thuthesis.dtx#L1447-L1461
        \setCJKfamilyfont{zhfs}   {Fangsong}      [AutoFakeBold={\FakeBoldSize}]
        \setCJKfamilyfont{zhhei}  {Heiti SC Light}  [BoldFont={Heiti SC Medium}]
        \setCJKfamilyfont{zhkai}  {Kaiti SC}        [BoldFont={Kaiti SC Bold}]
        \setCJKfamilyfont{zhsong} {Songti SC Light} [BoldFont={Songti SC Bold}]

        \setCJKmainfont[AutoFakeBold={\FakeBoldSize}]{Fangsong}
    }
}

\setmainfont[Path=./fonts/, BoldFont={*Bold}, ItalicFont={*Italic}, BoldItalicFont={*BoldItalic}]{TimesNewRoman}
\renewcommand{\bibfont}{\zihao{5}\songti}

截图

No response

其他信息

No response

cxzhou35 commented 1 month ago

升级了ctex的版本后解决