I was checking the solution here
for make a small fraction. I get the fraction but I noticed that there is a variation in the vertical alignment in display mode and inline mode:
\documentclass[12pt]{memoir}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{stackengine}
\newcommand{\smath}[1]{\text{\scalebox{0.95}{$#1$}}}
\newcommand{\myfrac}[3][0pt]{\belowbaseline[-.65\baselineskip]{\smath{\genfrac{}{}{}{3}{\raisebox{#1}{$#2$}}{\raisebox{-#1}{$#3$}}}}}
\begin{document}
$\tanh\Bigl(\myfrac{\alpha}{2}\Bigr)$
\begin{align}
\tanh\Bigl(\myfrac{\alpha}{2}\Bigr)
\end{align}
\end{document}
As you can see in display mode the fraction is moved up a little bit. This doesn't happen with equation environment nor \[ \]. What am I doing wrong?


genfracis defined inamsmath; I don't think it's redefined instackengine. – barbara beeton Apr 03 '21 at 19:17alignshould give exactly the same result asequation. But Id be inclined to use\dfrac` instead of trying to define something else. – barbara beeton Apr 03 '21 at 19:24\tfrac("t" for "text-sized"). See theamsmathuser guide for examples (texdoc amsldoc). – barbara beeton Apr 03 '21 at 19:30\tfracalters the space between lines in which it appears. – juanuni Apr 03 '21 at 19:36\dfraccan sometimes push adjacent lines of text apart but the result of\tfracis almost always small enough to fit within any reasonable baselines. And it certainly is with the particular numerator and denominator you show in your example. (But those are definitely smaller with\tfracthan what you show.) – barbara beeton Apr 03 '21 at 19:46\Bigland\Bigrfor the parenthesis with\tfrac. In such a situation, the space between lines is altered, in my case. if I use\bigland\bigrthe fraction is bigger than parenthesis. – juanuni Apr 03 '21 at 22:10\dfracdefinitely needs the\Bigparentheses, but\tfracdoes not; the parentheses come just to the bottom of the denominator, and that is preferable to parentheses that are too large. (Long experience and familiarity with editorial practices of a math publisher.) And\dfracby itself could cause the baselines to spread in text, depending on what is in the previous and following lines. I still recommend\tfrac. – barbara beeton Apr 03 '21 at 23:53\tfracis a good option, but in my case withstix2package,\tfracis bigger than\bigl(and\bigr). Then, I switchbtoB, but ocurrs the situation with space between lines. I would like to show the packages that I am using to find myself in that situation but this comes out of the query made. – juanuni Apr 04 '21 at 04:15stix2. (It's frustrating.) That information should have been made clear in your question. – barbara beeton Apr 04 '21 at 14:47stix2package. The problem with space between lines is another question. In any case, I appreciate your time and interest. – juanuni Apr 04 '21 at 17:10equationandamsmathenvironments do not always typeset the same way. This question is a prime example. Theamsmathenvironments redefine the value of\baselineskip. Since this OP's definition makes use of that value, the results vary. – Steven B. Segletes Apr 08 '21 at 01:22