# How can I make something like a superscript that doesn't go as high?

The \textsuperscript command makes the superscripted text go above the top of capital letters. Here's an example showing what I mean:

\textsuperscript{3} И сказ


As you can see, the superscripted 3 goes above the capital letter height.

I would like something similar to a superscript, but that is constrained by the capital letter height, as shown below.

Is there a relatively simple way to do this in TeX?

## 3 Answers

You can define a command \Textsuperscript in a similar fashion to the kernel's \textsuperscript, but using an appropriate \raise instead of the original ^; something along these lines:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}

\makeatletter
\newlength\mylen
\DeclareRobustCommand*\Textsuperscript[1]{%
\@Textsuperscript{\selectfont#1}}
\def\@Textsuperscript#1{%
\settoheight\mylen{\fontsize\f@size\z@ A}%
{\m@th\ensuremath{\raise.3\mylen\hbox{\fontsize\sf@size\z@#1}}}}
\makeatother

\begin{document}

\textsuperscript{3}И сказ

\Textsuperscript{3}И сказ

\Large
\textsuperscript{3}И сказ

\Textsuperscript{3}И сказ

\Huge
\textsuperscript{3}И сказ

\Textsuperscript{3}И сказ

\end{document}


Here are the original definitions:

\DeclareRobustCommand*\textsuperscript[1]{%
\@textsuperscript{\selectfont#1}}
\def\@textsuperscript#1{%
{\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}


The constraint you pose is not easy to achieve, because it's contradictory: some capital letters (and even numbers), don't cover the whole capital height. Some glyphs are short of it, others overshoot it. Therefore one has to accept a compromise. In the following I used A for getting the height; if your superscripts have only numbers, it's sensible to use 0 in the second measurement using \fontcharht.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}

\makeatletter
\DeclareRobustCommand*\lowsuperscript[2][\sf@size]{%
\@lowsuperscript{#1}{#2}}
\newcommand\@lowsuperscript[2]{%
{\check@mathfonts % be sure \sf@size is defined
\dimen0=\fontcharht\fontA
\fontsize{#1}\z@\selectfont
\advance\dimen0-\fontcharht\fontA % might be \fontcharht\font0
\raisebox{\dimen0}{#2}%
}%
}
\makeatother

\begin{document}
\textsuperscript{3AI}И сказ \quad\lowsuperscript{3AI}И сказ

\Huge\textsuperscript{3AI}И сказ \quad\lowsuperscript{3AI}И сказ

\Huge\textsuperscript{3AI}И сказ \quad\lowsuperscript[10]{3AI}И сказ
\end{document}


The \lowsuperscript command has an optional argument for supplying an explicit font size for the cases, like in \Huge where the subscript size (\sf@size) as determined by LaTeX is too big. I used 10 by way of example, it's probably too small, however.

This way works for different font scales (after several edits).

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{stackengine}
\newcommand\myss[1]{\belowbaseline[0pt-\heightof{И}]{\scriptsize#1}}
\begin{document}
\myss{3} И сказ

\LARGE
\myss{3} И сказ
\end{document}


For a version having the superscript scale, I use a \scalebox, in this case with a scale ratio set to 60%

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{stackengine}
\usepackage{graphicx}
\newcommand\myss[1]{\belowbaseline[0pt-\heightof{И}]{\scalebox{.6}{#1}}}
\begin{document}
\myss{3} И сказ

\LARGE
\myss{3} И сказ
\end{document}


• +1 for the optical illusion. Both 3s are the same size, but the one on top looks larger. Sep 9 '13 at 17:44
• @PeterOlson "Fixed" by adding another package (graphicx) and using a \scalebox`. Some would say adding another package is not a fix :^) Sep 9 '13 at 18:15