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:

\usepackage[legalpaper, landscape, margin=0.8in,right=1.5in]{geometry}
\newfontfamily{\hindifont}[script=Devanagari]{Lohit Devanagari}


\up{भूः}{5}{0} \up{ति}{3}{}s2345:

enter image description here

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: enter image description here 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.

\newcommandx*{\upp}[3]{\Longstack{\footnotesize{#3#2} #1}}

\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}{}: ।।

Rendered output: enter image description here

1 Answer 1


I think stackengine is what you want. enter image description here


\Longstack{a b}
\Longstack{a e}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .