Aligning defined functions on sums
A stackengine
approach, with scalerel
for handling the change in math style size.
REVISED ANSWER
This can present nicely in all math styles and corrects the issue with my alternate solutions that the drop of a subscript is not uniform but depends on the letter height. For this application, that is not a helpful feature.
\documentclass{article}
\usepackage{stackengine,scalerel}
\stackMath
\newcommand\hypop[4]{%
\ThisStyle{\litlet{#2}\stackengine{.2\LMex}{%
\stackengine{.2\LMex}{\SavedStyle\triangle}{\scalebox{.5}{$\SavedStyle#4$}}{O}{c}{F}{F}{L}%
}{\SavedStyle\litlet{#1}}{O}{c}{F}{F}{S}\litlet{#3}}%
}
\newcommand\litlet[1]{\raisebox{-.4\LMex}{\scalebox{.7}{$\SavedStyle#1$}}}
\begin{document}
\[
\hypop{a}{b}{c}{n} ~
\scriptstyle\hypop{a}{b}{c}{n}~
\scriptscriptstyle\hypop{a}{b}{c}{n}
\]
\[\sum^{\hypop{a}{b}{c}{n}}_{\hypop{a}{b}{c}{n}} \]
\end{document}
ORIGINAL ANSWER
The triangle is always presented in \displaystyle
and argument #4
is always presented in \scriptscriptstyle
. However, the point letters of the triangle (arguments #1
-#3
) get smaller when \hypop
is used as a subscript.
\documentclass{article}
\usepackage{stackengine,scalerel}
\stackMath
\newcommand\hypop[4]{%
\ThisStyle{{}_{#2} \stackengine{1pt}{%
\stackengine{\dimexpr.72ex+.10\LMex}{\triangle}{_{_{\mkern2mu#4}}}{O}{c}{F}{F}{L}%
}{\SavedStyle_{#1}}{O}{c}{F}{F}{S} {}_{#3}}%
}
\begin{document}
\[Intended~output~above~and~below~the~sum:\hypop{a}{b}{c}{n}\]
\[Actual~output:\sum^{\hypop{a}{b}{c}{n}}_{\hypop{a}{b}{c}{n}} \]
\end{document}
One can keep the triangle size fixed, but if a smaller size is preferred, a \scalebox
would work, here scaled by 80% with respect to the original presentation above:
\documentclass{article}
\usepackage{stackengine,scalerel}
\stackMath
\newcommand\hypop[4]{%
\ThisStyle{%
{}_{#2} \stackengine{1pt}{\scalebox{.8}{%
$\stackengine{\the\dimexpr.72ex+.10\LMex}{\triangle}{_{_{\mkern2mu#4}}}{O}{c}{F}{F}{L}$}%
}{\SavedStyle_{#1}}{O}{c}{F}{F}{S} {}_{#3}}%
}
\begin{document}
\[Intended~output~above~and~below~the~sum:\hypop{a}{b}{c}{n}\]
\[Actual~output:\sum^{\hypop{a}{b}{c}{n}}_{\hypop{a}{b}{c}{n}} \]
\end{document}
Here's a version that uses a few additional \raisebox
and \scalebox
instructions to place the letters "b" and "c".
\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\newcommand{\ca}[1]{\operatornamewithlimits{\mathpalette\cb{#1}}}
\newcommand{\cb}[2]{{%
\vphantom{\triangle}%
\ooalign{$#1\triangle$\cr\hidewidth\cc{$#1#2$}\hidewidth\cr
}%
}}
\newcommand{\cc}[1]{%
\raisebox{.35\height}{\scalebox{0.45}{#1}}%
}
\newcommand{\hypop}[4]{%
\raisebox{-0.25ex}{\scalebox{0.5}{$#2$}}
\mkern-2.5mu
\ca{#4}\limits^{\mkern-0.5mu\scalebox{0.5}{$#1$}}
\mkern-2.8mu
\raisebox{-0.25ex}{\scalebox{0.5}{$#3$}}}
\begin{document}
Various math styles:
$ \hypop{a}{b}{c}{n} \quad
\scriptstyle \hypop{a}{b}{c}{n} \quad
\scriptscriptstyle \hypop{a}{b}{c}{n}$
With summation symbol:
$\displaystyle \sum^{\hypop{a}{b}{c}{n}}_{\hypop{a}{b}{c}{n}}$
\end{document}