我注意到\bar
和\overbar
中所定义的unicode-math
并没有在字母上方产生居中条。
例如
\documentclass{article}
\usepackage{amsmath,unicode-math}
\unimathsetup{math-style=ISO,bold-style=ISO,sans-style=italic}
\setmathfont{texgyrepagella-math.otf}
%\setmathfont[range={scr,bfscr}]{texgyredejavu-math.otf}
\begin{document}
\begin{align}
\bar{\mscrw} \overbar{\mscrw}
\end{align}
\end{document}
我得到:
我能做些什么吗?
PS:我正在使用带有 lualatex 的 texlive 2018。
答案1
这看起来像是一个字体错误。
如果使用,\bar{{}\mscrw}
输出将符合预期。
\documentclass{article}
\usepackage{amsmath,unicode-math}
\unimathsetup{math-style=ISO,bold-style=ISO,sans-style=italic}
\setmathfont{texgyrepagella-math.otf}
\begin{document}
\begin{gather}
\bar{\mathscr{a}} \overbar{\mathscr{a}} \wideoverbar{\mathscr{a}} \\
\bar{\mathscr{b}} \overbar{\mathscr{b}} \wideoverbar{\mathscr{b}} \\
\bar{\mathscr{d}} \overbar{\mathscr{d}} \wideoverbar{\mathscr{d}} \\
\bar{\mathscr{g}} \overbar{\mathscr{g}} \wideoverbar{\mathscr{g}} \\
\bar{\mathscr{u}} \overbar{\mathscr{u}} \wideoverbar{\mathscr{u}} \\
\bar{\mathscr{w}} \overbar{\mathscr{w}} \wideoverbar{\mathscr{w}} \\
\bar{{}\mscrw} \overbar{{}\mscrw} \wideoverbar{{}\mscrw}
\end{gather}
\end{document}
可以修复\bar
(和其他口音以同样的方式):
\documentclass{article}
\usepackage{amsmath,unicode-math}
\unimathsetup{math-style=ISO,bold-style=ISO,sans-style=italic}
\setmathfont{texgyrepagella-math.otf}
\ExplSyntaxOn
\cs_set_protected:Nn \bonanza_bar_new:n
{
\str_case:nnTF { #1 }
{
{\mathscr{w}}{}
{\mscrw}{}
}
{ \bonanza_bar_original:n { {}#1 } }
{ \bonanza_bar_original:n { #1 } }
}
\AtBeginDocument
{
\cs_set_eq:NN \bonanza_bar_original:n \bar
\cs_set_eq:NN \bar \bonanza_bar_new:n
}
\ExplSyntaxOff
\begin{document}
\[
\bar{\mathscr{a}}+
\bar{\mathscr{b}}+
\bar{\mathscr{d}}+
\bar{\mathscr{g}}+
\bar{\mathscr{u}}+
\bar{\mathscr{w}}+
\bar{\mscrw}
\]
\end{document}
答案2
答案3
使用\widebar
本页的宏(略作修改)我可以不使用 mathabx 包来获得 \widebar 吗?
\documentclass{article}
\usepackage{amsmath,unicode-math}
\unimathsetup{math-style=ISO,bold-style=ISO,sans-style=italic}
\setmathfont{texgyrepagella-math.otf}
%\setmathfont[range={scr,bfscr}]{texgyredejavu-math.otf}
\makeatletter
\newcommand*\rel@kern[1]{\kern#1\dimexpr\macc@kerna}
\newcommand*\widebar[1]{%
\begingroup
\def\mathaccent##1##2{%
\rel@kern{0.8}%
\overline{\rel@kern{-0.8}\macc@nucleus\rel@kern{-0.1}}%
\rel@kern{-0.3}%
}%
\macc@depth\@ne
\let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
\mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
\macc@set@skewchar\relax
\let\mathaccentV\macc@nested@a
\macc@nested@a\relax111{#1}%
\endgroup
}
\makeatother
\begin{document}
$\widebar{\mscrw}$
\end{document}