跟进这问题,我试图使用 unicode 字符作为二元运算符。链接问题中的答案帮助我做到了这一点,但我遇到了第二个问题。我还想使用自定义符号作为二元运算符:
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{unicode-math}
\usepackage{fontspec}
\setmathfont{Latin Modern Math}
\setmathfont{Symbola}[range={\sphericalangleup,\lang},Scale=MatchUppercase]
\newcommand{\ang}{\mathbin{\sphericalangleup}}
\newcommand{\lang}{\mathbin{\raisebox{1pt}{\rotatebox[origin=c]{-116}{\sphericalangleup}}}}
This character prints: $\ang$
But this does not: $\lang$
And by the way \textbf{bold} works fine :)
Unless I use the fontspec command...
\fontspec{Symbola}
After which the character prints: $\lang$
Except now \textbf{bold} doesn't work :(
我尝试将自定义符号的命令\lang
放入范围内setmathfont
,但这不起作用,如上所示。fontspec
解决了这个问题但又产生了另一个问题(见上文)。
答案1
由于\sphericalangleup
是一个数学命令,您需要在中启动数学模式\raisebox
。
另一方面,没有必要定义数学字体,因为 Symbola 没有定义数学字体。
\documentclass{article}
%\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{unicode-math}
\usepackage{fontspec}
\setmathfont{Latin Modern Math}
\newfontface{\symbolafont}{Symbola}
\newcommand{\symbolasphericalangleup}{\text{\symbolafont\symbol{"29A1}}}
\newcommand{\ang}{\mathbin{\symbolasphericalangleup}}
\newcommand{\lang}{%
\mathbin{%
\raisebox{1pt}{\rotatebox[origin=c]{-116}{\symbolasphericalangleup}}%
}%
}
\begin{document}
This character prints: $\ang$
But this does not: $\lang$
And by the way \textbf{bold} works fine :)
\end{document}