如何为非数学字体的符号分配数学代码?

如何为非数学字体的符号分配数学代码?

我想使用腓尼基字母(unicode 范围 0x10900 到 0x1091F)作为变量名。(如果您的浏览器字体支持它们,则这些是字符:

答案1

您可能会相信这是某种数学符号,但另一种方法是使用 OpenType 字体(这些使用编码)沿着/路径unicode-math前进:\DeclareSymbolFont\UmathcodeTU

\documentclass{article}
\usepackage{unicode-math}

% First for the text case. Not needed if it shouldn't be used for text
\newfontfamily\phoenicianfamily[
  Renderer=HarfBuzz, % Could be omitted or replaced by = Node, shouldn't matter that much
  Script=Phoenician, % Always specify the right script.
  % Language= % I have no idea which language you are using.
]{Noto Sans Phoenician}
\newcommand\textalf{{\phoenicianfamily 

答案2

将文本模式命令包装在 中\textnormal,它在文本和数学模式下都有效。

\documentclass{article}
\usepackage{unicode-math}

\setmathfont{latinmodern-math.otf}
% Availabe for free at:
% https://fonts.google.com/noto/specimen/Noto+Sans+Phoenician
\newfontface\phoenicianfont{Noto Sans Phoenician}
\newcommand\alf{\textnormal{\phoenicianfont\symbol{"10900}}} % Alf, 

答案3

作为该策略的替代\DeclareSymbolFont,您可以使用newunicodechar

\documentclass{article}
\usepackage{unicode-math}
\usepackage{amsmath}
\usepackage{newunicodechar}

\setmathfont{latinmodern-math.otf}
\newfontface\phoenician{Noto Sans Phoenician}

\newunicodechar{

相关内容