You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS下XeLaTeX编译Beamer幻灯片出现nullfont字符缺失警告的解决方法

解决XeLaTeX编译Beamer幻灯片时的nullfont字符缺失警告

在MacOS系统上使用XeLaTeX引擎编译Beamer测试幻灯片时,出现如下警告:

Missing character: There is no 5 ("35) in font nullfont! LaTeX [Ln 1, Col 1]
Missing character: There is no 1 ("31) in font nullfont! LaTeX [Ln 1, Col 1]
Missing character: There is no 3 ("33) in font nullfont! LaTeX [Ln 1, Col 1]
Missing character: There is no 1 ("31) in font nullfont! LaTeX [Ln 1, Col 1]
Missing character: There is no 9 ("39) in font nullfont! LaTeX [Ln 1, Col 1]
Missing character: There is no 2 ("32) in font nullfont! LaTeX [Ln 1, Col 1]
Missing character: There is no 5 ("35) in font nullfont! LaTeX [Ln 1, Col 1]

测试代码如下:

\documentclass[12pt]{beamer}
\setbeamertemplate{bibliography item}[text]
\mode<presentation> 
{
\usetheme{Madrid}
}


\title[About Beamer] 
{About the Beamer class in presentation making}

\subtitle{A short story}

\author[Arthur, Doe]
{A.~B.~Arthur\inst{1} \and J.~Doe\inst{2}}

\institute[VFU] % (optional)
{
  \inst{1}%
  Faculty of Physics\\
  Very Famous University
  \and
  \inst{2}%
  Faculty of Chemistry\\
  Very Famous University
}

\date[VLC 2020] % (optional)
{Very Large Conference, April 2013}



\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}



\begin{document}

\frame{\titlepage}

\begin{frame}
\frametitle{Table of Contents}
\tableofcontents
\end{frame}


\section{Introduction}

\begin{frame}
\frametitle{Sample frame title}

\colorbox{orange}{highlight}

In this slide, some \textbf{important} text will be
\alert{highlighted} because it's important.
Please, don't \textcolor{green}{abuse} it. 

\begin{block}{Remark}
Sample text
\end{block}

\begin{alertblock}{Important theorem}
Sample text in red box
\end{alertblock}

\begin{examples}
Sample text in green box. The title of the block is ``Examples".
\end{examples}

\end{frame}


% Insert a thank you frame
\begin{frame}
\Huge{\centerline{Thank you!}}
\end{frame}

\end{document}

解决方法

这个警告是XeLaTeX和Beamer部分模板交互时的小问题——系统尝试用nullfont输出数字字符,但nullfont本身不包含任何字符,所以触发警告。可以用以下几种方式解决:

  • 注释掉无用的模板命令
    你代码里的\setbeamertemplate{bibliography item}[text]在没有添加参考文献的情况下是多余的,直接注释掉这行:

    % \setbeamertemplate{bibliography item}[text]
    

    重新编译后警告就会消失。

  • 加载fontspec字体包
    在导言区添加fontspec包并指定系统可用字体,让XeLaTeX用正常字体处理这些字符:

    \usepackage{fontspec}
    \setmainfont{Times New Roman} % 换成你系统里有的字体,比如PingFang SC
    
  • 更新TeX发行版
    旧版本的Beamer或XeLaTeX可能存在这类兼容性bug,把你的MacTeX(或其他TeX发行版)更新到最新版本,也能自动修复该问题。

内容的提问来源于stack exchange,提问作者XMan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 06:06:13