I requested help to compose Sanskrit text and with the answers said here, I was able to compose many pages of Sanskrit texts with numbers raised as superscript-like over the base character.
The height of each character is not same in Sanskrit similar to English. For example 'भ' and 'ति'will occupy different height similar to English characters 'e' and 'f'.
This affects how the characters raised above are aligned.
For example the present lines renders as below:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{polyglossia}
\usepackage{xargs}
\usepackage[legalpaper, landscape, margin=0.8in,right=1.5in]{geometry}
\usepackage{multicol}
\setdefaultlanguage{hindi}
\newfontfamily{\hindifont}[script=Devanagari]{Lohit Devanagari}
\newcommand{\hi}[1]{\large\begin{hindifont}#1\end{hindifont}}
\newcommandx*{\up}[3]{$\overset{\text{\hi{#2#3}}}{\text{\begin{hindifont}#1\end{hindifont}}}$}
\begin{document}
\Huge
\up{भूः}{5}{0} \up{ति}{3}{}s2345:
\newline
\overset{\lower.5em\hbox{aaa}}{bbb}
\end{document}
I would like keep 50 and 3 aligned in the above by moving the 50 to match 3. I find this not a problem with Sanskrit but also with the English text. Any help to revise my macro to keep 50 at same height as 3 will be helpful.
Update:
When I used ruby text in HTML and composed similar lines, I could see the 50 and 3 are aligned as below:
So I am wondering will this still be a rendering challenge or is it that some other setting or parameter in Latex is to be used to achieve same as shown by a HTML renderer.
Another update: This link seems to be seeking similar solution, but I could not comprehend how to implement as a solution for me.
Final update:
With help of the accepted answer, the following code helped to arrive at the need.
\usepackage{stackengine}
\newcommandx*{\upp}[3]{\Longstack{\footnotesize{#3#2} #1}}
\newline
\Longstack{50 भूः} । \Longstack{3 ति}s2345
\upp{ऒ}{1}{}म् । \upp{भूः}{5}{} । \upp{भूः}{1}{0} । \upp{हॊ}{1}{}इ । \upp{भूः}{0}
{} । हॊइ । \upp{भूः}{0}{} । \upp{हा}{2}{}s31उवा\upp{s2}{-}{-} । \upp{ए}{0}{} ।
\upp{सु}{1}{}व\upp{र्ज्यॊ}{0}{}\upp{ति}{3}{}s2\upp{3}{1}{}\upp{4}{1}{}\upp{5}{1}{}: ।।