函數限制:下標看起來太低

函數限制:下標看起來太低

當編寫某些函數的限制時,有時限制區域(下標)會低於垂直線的底部(特別是對於kpfont-otf我正在使用的字體包)。

在此輸入影像描述

有沒有辦法確保下標不低於垂直線的底部,或至少再提高一點?

下面是 MWE。

\documentclass{article}
\usepackage{kpfonts-otf}

% https://tex.stackexchange.com/questions/22252/
\newcommand\restr[2]{{% we make the whole thing an ordinary symbol
  \left.\kern-\nulldelimiterspace % automatically resize the bar with \right
  #1 % the function
  \littletaller % pretend it's a little taller at normal size
  \right|_{#2} % this is the delimiter
  }}

\newcommand{\littletaller}{\mathchoice{\vphantom{\big|}}{}{}{}}

\begin{document}

\[
    \restr{f}{U}=\frac{\restr{g}{U}}{\restr{h}{U}}
\]

\[
    \restr{\frac{\partial}{\partial X_i}}{P}
\]

\end{document}

答案1

如果U是整個\left...\right組的下標,它將低於垂直線,如 John Kormylo 所解釋的。但是你可以附加另一個與你的公式深度相同的不可見的數學原子,並為其添加U下標,那麼它會降低得更少。

\left...\right另一個數學原子必須是 Close 類型,因為群和 Close 原子之間沒有空格:

\newcommand\restr[2]{{% we make the whole thing an ordinary symbol
  \left.\kern-\nulldelimiterspace % automatically resize the bar with \right
  #1 % the function
  \littletaller % pretend it's a little taller at normal size
  \right|\mathclose{\vphantom{#1}}_{#2} % this is the delimiter
  }}

在此輸入影像描述

kpfonts-otf相對於它們所包含的公式,分隔符號似乎太小了。您可以在\delimiterfactor=1100後面強制使用更大的分隔符號\begin{document}

在此輸入影像描述

但這感覺就像是駭客攻擊。

更深入的分析

在數學公式中\left.g\right|(沒有\delimiterfactor破解),中的豎線kpfonts-otf比 Computer Modern 中的豎線短 1.25pt。此外,Computer Modern 條已經以數學軸為中心,而kpfonts-otf條必須升高 1.925pt,從而放大了它不夠低的效果。

kpfonts-otf

\TU/KpMath-Regular.otf(1)/m/n/10 

相關內容