When writing the restriction of some function, sometimes the restriction area (the subscript) goes under the bottom of the vertical line (especially for the font package kpfont-otf I'm using).
Is there some way to ensure the subscript not to be lower than the bottom of the vertical line, or at lease raise it up a little bit?
Below is a 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}



\raiseboxwould make the content in it in text style, so did you mean that one should manually add the$...$and add\scriptstylehere? 2) Regarding\depth, what did you mean by "raise it by \depth"? – Jinwen Oct 07 '22 at 15:20\raiseboxto raise the subscript, then there would still be some (now empty) vertical space under the subscript, which would lead to extra space in the upper part of\frac. – Jinwen Oct 07 '22 at 15:33