当对 STIXTwoMath OTF 字体使用 \big 或 \left 或 \right 时,如何使用 \Udelcode 作为大分隔符?

当对 STIXTwoMath OTF 字体使用 \big 或 \left 或 \right 时,如何使用 \Udelcode 作为大分隔符?

我想使用 STIXTwoMath-Regular.otf 的 OTF 版本,以获取较大的分隔符,例如 (),[],{ },|,/,\vert,\Vert,\langle,\rangle,\lceil,\rceil, 等等,我需要修改通过 声明的所有分隔\DeclareMathDelimiter{}{}{}{}{}{}fontmath.ltx

我通过\Udelcode ⟨char slot⟩ [=] ⟨fam.⟩ ⟨glyph slot⟩命令重新定义,仅获得几个分隔符的正确输出 (),[],|

使用 \big 或 \left 时,其中一些无法正确呈现,它正在加载默认的 LaTeX CMR 字体(CMEX10)

如何修改以获得 \left< . \right>、\langle、\rangle、\vert、\Vert、\lceil、\rceil 的正确字体加载(OTF),

平均能量损失

\documentclass{book}
\usepackage{mathspec}
\setmainfont{STIXTwoMath-Regular.otf}
\setmathsfont(Latin){STIXTwoMath-Regular.otf}
\setmathsfont(Digits){STIXTwoMath-Regular.otf}
\setmathsfont(Greek){STIXTwoMath-Regular.otf}
\setmathsfont(Symbols){STIXTwoMath-Regular.otf}

\newfontface\StixMath{STIXTwoMath-Regular.otf}[Scale=1.0,NFSSFamily=stix]
\DeclareSymbolFont{Stixsym}{TU}{stix}{m}{n}

%%% for Bracket
\Udelcode`\[\symStixsym"005B
\Udelcode`\]\symStixsym"005D

%%% for paranthesis
\Udelcode`\(\symStixsym"0028
\Udelcode`\)\symStixsym"0029

%%% for |
\Udelcode`\|\symStixsym"007C

\Udelcode`\<\symStixsym"3C
\Udelcode`\>\symStixsym"3E

\xdef\sqrt{\Uradical\symStixsym"221A}

\begin{document}

%%%%%%%%%%%%%%%% ( )

$(01234567890)$

$\big( \Big( \bigg( \Bigg(  abcdefghijklmnopqrstuvwxyz \big) \Big) \bigg) \Bigg)$


$\displaystyle \left( \frac{1}{2} \right)$\medskip

==========================\medskip

%%%%%%%%%%%%%%%% [ ]


$[01234567890]$

$\big[ \Big[ \bigg[ \Bigg[  abcdefghijklmnopqrstuvwxyz \big] \Big] \bigg] \Bigg]$


$\displaystyle \left[ \frac{1}{2} \right]$\medskip


==========================\medskip
%%%%%%%%%%%%%%%% | |


$|01234567890|$

$\big| \Big| \bigg| \Bigg|  abcdefghijklmnopqrstuvwxyz \big| \Big| \bigg| \Bigg|$


$\displaystyle \left| \frac{1}{2} \right|$


==========================\medskip


$<01234567890>$



$\big< \Big< \bigg< \Bigg<  abcdefghijklmnopqrstuvwxyz \big> \Big> \bigg> \Bigg>$

$\displaystyle \left< \frac{1}{2} \right>$

=========

$\{01234567890\}$

$\big\{01234567890\big\}$

$\big\{01234567890\big\}$


$\big\{ \Big\{ \bigg\{ \Bigg\{  abcdefghijklmnopqrstuvwxyz \big\} \Big\} \bigg\} \Bigg\}$

$\displaystyle \left\{ \frac{1}{2} \right\}$

=========

$\sqrt{2}$

$\displaystyle\sqrt{\frac{1}{2\frac{1}{2}}}$


===================

$\displaystyle\big\vert \Big\vert \bigg\vert \Bigg\vert  abcdefghijklmnopqrstuvwxyz \big\vert \Big\vert \bigg\vert \Bigg\vert$

$\displaystyle\big\Vert \Big\Vert \bigg\Vert \Bigg\Vert  abcdefghijklmnopqrstuvwxyz \big\Vert \Big\Vert \bigg\Vert \Bigg\Vert$

$\displaystyle\big\langle \Big\langle \bigg\langle \Bigg\langle  abcdefghijklmnopqrstuvwxyz \big\rangle \Big\rangle \bigg\rangle \Bigg\rangle$

$\displaystyle\big\lceil \Big\lceil \bigg\lceil \Bigg\lceil  abcdefghijklmnopqrstuvwxyz \big\rceil \Big\rceil \bigg\rceil \Bigg\rceil$

\end{document} 

答案1

您还需要设置数学代码。

\documentclass[twocolumn]{article}
\usepackage{mathspec}
\setmainfont{STIX Two Text}
\setmathsfont(Latin){STIXTwoMath-Regular.otf}
\setmathsfont(Digits){STIXTwoMath-Regular.otf}
\setmathsfont(Greek){STIXTwoMath-Regular.otf}
\setmathsfont(Symbols){STIXTwoMath-Regular.otf}

\newfontface\StixMath{STIXTwoMath-Regular.otf}[Scale=1.0,NFSSFamily=stix]
\DeclareSymbolFont{Stixsym}{TU}{stix}{m}{n}

%%% for bracket
\Umathcode`\[ = "4 \symStixsym "005B
\Umathcode`\] = "5 \symStixsym "005D
\Udelcode`\[ = \symStixsym "005B
\Udelcode`\] = \symStixsym "005D

%%% for parenthesis
\Umathcode`\( = "4 \symStixsym "0028
\Umathcode`\) = "5 \symStixsym "0029
\Udelcode`\( = \symStixsym"0028
\Udelcode`\) = \symStixsym"0029

%%% for |
\Umathcode`\| = "0 \symStixsym "007C
\Udelcode`\| = \symStixsym"007C
\def\vert{\Udelimiter "0 \symStixsym "007C }
\def\Vert{\Udelimiter "0 \symStixsym "2016 }

%%% for angle brackets
\def\langle{\Udelimiter "4 \symStixsym "27E8 }
\def\rangle{\Udelimiter "5 \symStixsym "27E9 }
\Udelcode`\<\symStixsym"27E8
\Udelcode`\>\symStixsym"27E9

%%% for braces
\def\lbrace{\Udelimiter "4 \symStixsym "007B }
\def\rbrace{\Udelimiter "5 \symStixsym "007D }

%%% floor
\def\lfloor{\Udelimiter "4 \symStixsym "230A }
\def\rfloor{\Udelimiter "4 \symStixsym "230B }

%% ceiling
\def\lceil{\Udelimiter "4 \symStixsym "2308 }
\def\rceil{\Udelimiter "4 \symStixsym "2309 }

\xdef\sqrt{\Uradical\symStixsym"221A }

\begin{document}

\subsection*{Parentheses}

$(01234567890)$

$\big( \Big( \bigg( \Bigg(  abcdefghijklmnopqrstuvwxyz \big) \Big) \bigg) \Bigg)$

$\displaystyle \left( \frac{1}{2} \right)$

\subsection*{Brackets}

$[01234567890]$

$\big[ \Big[ \bigg[ \Bigg[  abcdefghijklmnopqrstuvwxyz \big] \Big] \bigg] \Bigg]$

$\displaystyle \left[ \frac{1}{2} \right]$

\subsection*{Bars}

$|01234567890|$

$\big| \Big| \bigg| \Bigg|  abcdefghijklmnopqrstuvwxyz \big| \Big| \bigg| \Bigg|$

$\displaystyle \left| \frac{1}{2} \right|$

\subsection*{Angle brackets}

$\langle 01234567890\rangle$

$\big< \Big< \bigg< \Bigg<  abcdefghijklmnopqrstuvwxyz \big> \Big> \bigg> \Bigg>$

$\displaystyle \left< \frac{1}{2} \right>$

\subsection*{Braces}

$\{01234567890\}$

$\big\{ \Big\{ \bigg\{ \Bigg\{  abcdefghijklmnopqrstuvwxyz \big\} \Big\} \bigg\} \Bigg\}$

$\displaystyle \left\{ \frac{1}{2} \right\}$

\subsection*{Radical}

$\sqrt{2}$

$\displaystyle\sqrt{\frac{1}{2\frac{1}{2}}}$


\subsection*{Misc}

$\displaystyle\big\vert \Big\vert \bigg\vert \Bigg\vert  abcdefghijklmnopqrstuvwxyz \big\vert \Big\vert \bigg\vert \Bigg\vert$

$\displaystyle\big\Vert \Big\Vert \bigg\Vert \Bigg\Vert  abcdefghijklmnopqrstuvwxyz \big\Vert \Big\Vert \bigg\Vert \Bigg\Vert$

$\displaystyle\big\langle \Big\langle \bigg\langle \Bigg\langle  abcdefghijklmnopqrstuvwxyz \big\rangle \Big\rangle \bigg\rangle \Bigg\rangle$

$\displaystyle\big\lceil \Big\lceil \bigg\lceil \Bigg\lceil  abcdefghijklmnopqrstuvwxyz \big\rceil \Big\rceil \bigg\rceil \Bigg\rceil$

$\displaystyle\big\lfloor \Big\lfloor \bigg\lfloor \Bigg\lfloor  abcdefghijklmnopqrstuvwxyz \big\rfloor \Big\rfloor \bigg\rfloor \Bigg\rfloor$

\end{document} 

此后,pdffonts显示

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
VNNHAY+STIXTwoText-Bold-Identity-H   CID Type 0C       Identity-H       yes yes yes      4  0
BELAGZ+STIXTwoMath-Regular-Identity-H CID Type 0C       Identity-H       yes yes yes      6  0
NQCIYR+STIXTwoText-Identity-H        CID Type 0C       Identity-H       yes yes yes      8  0

所以没有使用 Computer Modern 字形。

相关内容