[Tex/LaTex] Write text (or symbol) vertically below another symbol in latex

math-operatorsvertical alignment

I have to write some equations in latex, my Latex equation:

    \begin{align}
G _{a_{1},\ldots ,a_{k}}\ast_{b_{1},\ldots ,b_{k}} G^{\prime }=G^{\prime \prime }
\end{align}

How can I make the text like this:
enter image description here

I have to write an equations in latex like this:
enter image description here

Best Answer

I use a \Centerstack to accomplish the stack. I place the top and bottom items in a \mathsf wrapper, and I introduce \coresym[scale]{symbol}{subscript/superscript} to center the core symbol and scale it as needed.

\documentclass{article}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\newcommand\coresym[3][1]{\phantom{#3}\scalebox{#1}{$#2$}#3}
\setstackgap{L}{.9\baselineskip}
\stackMath
\begin{document}
\[
\Centerstack{\mathsf{G} \\ \coresym[1.3]{*}{^1_2} \\ \mathsf{G}} =  ax + b
\]
\end{document}

enter image description here

I also shrunk the stacking gap between items to .9\baselineskip, but that can be changed to suit. Here it is shrunk to .7\baselineskip.

enter image description here