Giter Club home page Giter Club logo

Comments (7)

muzimuzhi avatar muzimuzhi commented on August 12, 2024

我尝试用\setCJKmainfont[AutoFakeBold,AutoFakeSlant]{SimSun}来规避这个问题。但是仍然报错是SimHei not found

伪粗体、伪斜体依然需要加载原本的字体,所以这从来不是一个规避的办法。我不在 windows 下,留给用 windows 的用户提供帮助吧。

from forum.

sikouhjw avatar sikouhjw commented on August 12, 2024

问题在于,在 \setCJKmainfont 之前,ctex 宏集会预加载 windows 下的字体,而此时已经使用了 SimHei

所以,应该使用 \documentclass[fontset=none]{ctexart} 来避免字体的预加载。

from forum.

muzimuzhi avatar muzimuzhi commented on August 12, 2024

问题在于,在 \setCJKmainfont 之前,ctex 宏集会预加载 windows 下的字体,而此时已经使用了 SimHei

@sikouhjw 这不冲突吧,在 preamble 里 \setCJKmainfont 可以重复使用。

例如,在 overleaf 的 linux 环境里,下面「把 FandolSong 两次设为 CJK main font」的例子,不报错。

\documentclass{ctexart}
\setCJKmainfont[AutoFakeBold,AutoFakeSlant]{FandolSong}

\begin{document}
\textbf{你好}
\end{document}

@gingerkitti 只加载 fontspec,试试能使用 windows 系统自带的其他 otf 字体(不论中文西文)吗,MiKTeX 自带的 otf 字体(不论中文西文)呢?

from forum.

sikouhjw avatar sikouhjw commented on August 12, 2024

@sikouhjw 这不冲突吧,在 preamble 里 \setCJKmainfont 可以重复使用。

例如,在 overleaf 的 linux 环境里,下面「把 FandolSong 两次设为 CJK main font」的例子,不报错。

我理解他的问题是「miktex 找不到 SimHei」,那问题就在于 ctex 的内部字体加载。

\setCJKmainfont 可以重复加载,但是后面的命令不会覆盖前面的命令,也就是说第一个 \setCJKmainfont 如果找不到字体,就会报错,而不会被第二个覆盖。

\documentclass{ctexart}
\setCJKmainfont{SimSun}[BoldFont=aaaa.otf]
\setCJKmainfont{SimSun}
\begin{document}
    test
\end{document}

所以解决他的办法:fontset=fandol 或者 =none 再自己配字体。

from forum.

muzimuzhi avatar muzimuzhi commented on August 12, 2024

@sikouhjw 啊,是我把 SimHeiSimSun 看成一个字体名了。现在我明白「用伪粗规避」和你提的 fontset=none 建议的意思了。抱歉

更新:想起我自己之前在 GitHub Actions 的 windows hoster 上跑 ctex 也遇到过这个问题,

SimHei is part of the Chinese (Simplified) Supplemental Fonts in Win 10. Thus all we need here is to install those supplemental fonts.

Originally posted by @muzimuzhi in muzimuzhi/hello-github-actions#10 (comment)

这下我也理解

由于在公司电脑,权限很低,无法自行安装软件以及连接外网,因此也不能下载字体

的意思了。

from forum.

gingerkitti avatar gingerkitti commented on August 12, 2024

非常感谢各位的帮忙。我后来在StackExchange也提了个类似的问题,

SimHei is not SimSun, and updmap has nothing to do with using fonts with fontspec. Try \documentclass[fontset=fandol]{ctexart} – Ulrike Fischer 19 hours ago

我照着评论的代码试了一下,居然成功了。

我又查了一下《CTEX 宏集手册》(2022/07/14 v2.5.10),发现第8页(4.3节)有这样一句话

注意:如果希望使用 \ctexset 在导言区指定字库,则需要先在宏包/文档类选项中指定
fontset = none(这会禁用 CTEX 宏集的操作系统检测功能和自动设定字库功能)。

我猜测可能跟这个有关系。之前我看手册里fontset后面没有“五角星”也没有“*”,也就没有管太多了。

我试了一下,如果说先这样设置\documentclass[fontset=none]{ctexart},后面不使用fandol,直接用伪粗体、伪斜体也是可以的,最终也可以输出伪粗伪斜。


@muzimuzhi 我试了一下应该是可以的

只加载 fontspec,试试能使用 windows 系统自带的其他 otf 字体(不论中文西文)吗,MiKTeX 自带的 otf 字体(不论中文西文)呢?

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Microsoft YaHei}
\begin{document}
\textbf{你好}
\end{document}

一些可能的题外话

虽然编译过程中还是会有很多Sorry, but miktex-makemf did not succeed.,但是并不影响结果,我也就没有多管它了(主要是超出了自己的能力范围),如果各位对于这个内容有什么见解还请多多指教(我也不知道这需不需要开新issue)

本来想睡一觉再想想怎么关掉这个issue,但是没想到各位这么热心,一觉功夫就有这么多评论,非常感谢各位的帮忙。

from forum.

muzimuzhi avatar muzimuzhi commented on August 12, 2024

虽然编译过程中还是会有很多Sorry, but miktex-makemf did not succeed.,但是并不影响结果

可以发第一例出来看看。

from forum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.