# How do I vertical align text?

This is question is related to an extension of an earlier question:

How do I display pi in LaTeX like Don?

I want to display using LaTeX, the HTML+CSS equivalent of

.pi sup { vertical-align: text-top; font-size: 96%; }

If pi is to be displayed as transcendental number, I want the numbers to hang from the ceiling like how you hang cloths like in Devanagari Indic scripts

• In order to show that pi is transcendental and not just irrational, I want to lift it from baseline and align it to the top of the font glyph box, giving it a bit of heavenly feel. – Sukii Oct 26 '14 at 16:21
• For those of us who aren't familiar with the appearance of Devanagari Indic script, it might be useful if you posted one or two lines of said script. – Mico Oct 26 '14 at 19:15
• Apologies for leading-up you guys in the wrong direction, I have now corrected the question. The trouble was that my CSS wasn't working the way it was doing in 'stackoverflow' – Sukii Oct 27 '14 at 3:31

Making only the most minor of changes to the 1st of my former approaches cited in the related question, perhaps this is what you are asking for.

The change amounts to placing the \scaleto inside a recursive stack. I used the \quietstack option of the stackengine package, to not print out intermediate results, saving it for the end with \usebox{\stackedbox}. I also set the stacking gap to -1pt (which can be altered to suit, possibly even a fraction of \curht if desired).

Changing the \stackunder to \stackon will reverse the vertical sense of the stack (3 on top, not bottom), as shown in the 2nd image.

\documentclass{article}
\usepackage{scalerel,stackengine}
\newlength\curht
\def\defaultdimfrac{.98}
\def\defaultstartht{\baselineskip}
\newcommand\diminish[2][\defaultdimfrac]{%
\def\quietstack{T}%
\setstackgap{S}{-1pt}
\curht=\defaultstartht\relax
\def\dimfrac{#1}%
\diminishhelpA{#2}%
}
\newcommand\diminishhelpA[1]{%
\expandafter\diminishhelpB#1\relax%
}
\def\diminishhelpB#1#2\relax{%
\stackunder{\scaleto{\strut#1}{\curht}}{\usebox{\stackedbox}}%
\curht=\dimfrac\curht\relax%
\ifx\relax#2\relax\usebox{\stackedbox}\else\diminishhelpA{#2}\fi%
}
\begin{document}
\def\pinum{3.14159265358979323846264338327950288419716939937510}
\def\defaultstartht{38pt}
\diminish[0.92]{\pinum}
\end{document}


or with \stackon

• I have now corrected the question. Please take a re-look at it. – Sukii Oct 27 '14 at 3:35
• @Sukii Does not the 3rd implementation of my prior answer give that solution? – Steven B. Segletes Oct 27 '14 at 5:54
• Sorry for not noting that. You are right, it was quite dumb of me not to realise that. You have probably answered much more than what I was looking for. I will think about others questions that map to your multiple answers? – Sukii Oct 27 '14 at 7:10

Surely a bad idea, but very easy to implement.

\documentclass{article}
\begin{document}
$\pi=3.14159^{2^{6^{5358979323846264338327950288419716939937510}}}$
\end{document}