当前位置:网站首页>【LaTex】 Font “FandolSong-Regular“ does not contain requested(fontspec)Script “CJK“.如何抑制此种警告?
【LaTex】 Font “FandolSong-Regular“ does not contain requested(fontspec)Script “CJK“.如何抑制此种警告?
2022-08-09 21:55:00 【键盘即钢琴】
一、背景
在LaTex中把文档类型设置成utf8编码类型的ctexart文档后,用xelatex编译引擎,就可以在正文部分顺利用上中文了。
\documentclass[UTF8]{ctexart}
但是还是可能出现一个警告【Font "FandolSong-Regular" does not contain requested(fontspec)Script "CJK".】。
这个警告是不带有严重负面后果的警告,但是如果读者你有强迫症,也是可以消除的。
本文主要参考了文章[LaTeX 中文使用] 抑制 xeCJK/fontspec 警告 no-script "CJK" - 知乎
二、解决方法
2.1 更加精准的抑制警告代码
下面这个代码块是一个模板,不认识某些复杂的命令不要紧,只要我们知道简单的\documentclass、\usepackage和\begin{document}、\end{document}就行了。
\documentclass{article}
\usepackage{fontspec}
\usepackage{xpatch}
\ExplSyntaxOn
\xpatchcmd \fontspec_new_script:nn
{ \__fontspec_warning:nxx }
{ \__fontspec_info:nxx }
{}{\fail}
% redeclare
\newfontscript{CJK}{hani}
% \newfontscript{CJK~Ideographic}{hani}
\ExplSyntaxOff
\usepackage{xeCJK}
\begin{document}
content
\end{document}
2.2 简单的抑制代码
将\PassOptionsToPackage{quiet}{fontspec}放至\documentclass的前面。
比如
\PassOptionsToPackage{quiet}{fontspec}
\documentclass[UTF8]{ctexart}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{xcolor}
\begin{document}
\color{red}123红色文字夹杂
\end{document}
最后的输出结果很完美嘛
边栏推荐
- Xiaohei's leetcode journey: 94. Inorder traversal of binary trees (supplementary Morris inorder traversal)
- [Microservice~Nacos] Nacos service provider and service consumer
- Cookie, session, token
- Flask introductory learning tutorial
- L3-2 Delete up to three characters (30 points)
- This article lets you quickly understand implicit type conversion [integral promotion]!
- Reinforcement Learning Weekly Issue 57: DL-DRL, FedDRL & Deep VULMAN
- Interpretation of the paper (DropEdge) "DropEdge: Towards Deep Graph Convolutional Networks on Node Classification"
- JS–比想象中简单
- STC8H Development (15): GPIO Drives Ci24R1 Wireless Module
猜你喜欢
阿里云架构师金云龙:基于云XR平台的视觉计算应用部署
Domestic mobile phone manufacturers once fought for it, but now it is the first to collapse...
Space not freed after TRUNCATE table
国内手机厂商曾为它大打出手,如今它却最先垮台……
Reinforcement Learning Weekly Issue 57: DL-DRL, FedDRL & Deep VULMAN
AI Knows Everything: Building and Deploying a Sign Language Recognition System from Zero
金山云地震,震源在字节?
华为鸿蒙3.0的野望:技术、应用、生态
力扣 1413. 逐步求和得到正数的最小值
你真的了解乐观锁和悲观锁吗?
随机推荐
Easyui 表单验证「建议收藏」
unit test
好未来,想成为第二个新东方
leetcode 38. 外观数列
LeetCode26: remove duplicates in sorted array
Synchronization lock synchronized traces the source
第十七期八股文巴拉巴拉说(数据库篇)
Domestic mobile phone manufacturers once fought for it, but now it is the first to collapse...
In-depth analysis of Apache EventMesh cloud-native distributed event-driven architecture
BulkInsert方法实现批量导入
[Microservice~Nacos] Configuration Center of Nacos
NIO Cup 2022 Nioke Summer Multi-School Training Camp 7 CFGJ
STC8H Development (15): GPIO Drives Ci24R1 Wireless Module
阿里云架构师金云龙:基于云XR平台的视觉计算应用部署
金山云地震,震源在字节?
ACM MM 2022 | Cloud2Sketch: 长空云作画,AI笔生花
In programming languages, the difference between remainder and modulo
用户代码未处理MetadataException
一文让你快速了解隐式类型转换【整型提升】!
Xiaohei leetcode's refreshing rainy day trip, just finished eating Yufei Beef Noodles, Mala Tang and Beer: 112. Path Sum