使用xelatex编译下表情emoji问题

发布于 2025-03-03 18:57:06

在vscode中使用如下代码

问题:查看emotion宏包发现支持xelatex编译,但是emotion{A}显示的pdf不显示表情

\documentclass[12pt,a4paper]{ctexart}
\usepackage{emotion}
\setCJKfamilyfont{STsong2}{Aa剑豪体.ttf}
\newcommand{\jianhao}{\CJKfamily{STsong2}}
\begin{document}

{\jianhao  你好}
\emotion{A}
证明如下格式:
\end{document}

86716bc4ee6bb562a6015decd211694.png

查看更多

关注者
0
被浏览
154
1 个回答
Sagittarius Rover
我要成为Typst糕手/(ㄒoㄒ)/~~
查看emotion宏包发现支持xelatex编译

是在何处看到的?我在文档里没有看到。

\emotion{A}

这个用法是在何处获知?

实际测试发现xelatex确实不可行lualatex可以顺利运行...

\documentclass[12pt,a4paper]{ctexart}
\usepackage{emotion}
\emotionsetup{Twemoji Mozilla}
\begin{document}
你好
\emotion{A} % 这个A你是在哪里看到的...

% \emotion{🇦}

\emotion{☃}

\emotion{☘}

\emotion{☝}

\emotion{☠}

\emotion{🥵}

\emotion{✌🏾}

\emotiondef{apple}{🍎}
\emotiondef{tea}{🍵}

\emotion{apple}

\emotion{tea}

你好
\end{document}

image.png

我不是很懂lualatex,但使用xelatex编译出现如下警告:

Package fontspec: 
(fontspec)    Ignored LuaTeX-only feature:
(fontspec)    'Renderer=Full/Basic/Node/Base/HarfBuzz'.

emotion.sty中我们可以看到:

%Line 8~14
% add emotion command
\newfontface \emotionfont: { Twemoji~Mozilla } [ Renderer = Harfbuzz ]

% enable update emoji font
\newcommand{\emotionsetup}[1]{
\renewfontface \emotionfont: {#1} [ Renderer = HarfBuzz]
}

此处已经指定了似乎只有luatex才支持的fontspec选项Renderer = Harfbuzz,这有可能是xelatex编译不出emoji的一个原因。

PS.剑豪体中文字体的设置与本问题无关,不需要写在mwe内。且提问时插入代码必须使用markdown的围栏代码块

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览