how to make subscripts automatically choose font size

Would it be possible to make subscripts in math mode automatically choose a smaller font when a subscript is in uppercase?

E.g., if I have sA, the "A" would appear quite big. Is it possible to tell the subscript operator _ to use a smaller font when it sees an uppercase letter?

A workaround is to define, say, \newcommand{\l}[1]{\scalebox{0.x}{$#1$}}. But I would like to see if what I desired can be made automatic?

-
What about using lowercase small-caps letters? They are meant for exactly the case that you need an uppercase letter with the height of a lowercase letter. Scaling will look strange next to lowercase subscripts as it decreases the stroke width of the letters. A smaller font size might look a bit better than scaling depending on the font but it's still not an elegant solution. –  Christian Jun 1 '12 at 13:31
tex.stackexchange.com/questions/13040/… would then be a relevant question. I don't find the solution there satisfactory though. –  Christian Jun 1 '12 at 13:39
Thanks a lot for the reply! Do you mean \textsc? But that seems not able to produce math fonts; if I used in as s_{\textsc{f}}, then the subscript is in the right size but not italic. –  braids Jun 1 '12 at 13:58
Yes, that's why I found the question I linked to above not satisfactory. –  Christian Jun 1 '12 at 14:14
Actually, I found another question that dealt with the italic issue of the \textsc: tex.stackexchange.com/questions/32942/… –  braids Jun 1 '12 at 14:20

\documentclass{article}
\begin{document}

$s_A s_{\!_A}$

\end{document}


you can define a shortcut for this

-
Nice idea but it doesn't look good beside a lowercase subscript either. It's too low. I'm going to include it in my overview to illustrate. –  Christian Jun 1 '12 at 14:42
Thanks! Works nice withe \mathsmaller –  braids Jun 1 '12 at 16:52

The normal setting for the sizes are decided as follows:

\DeclareMathSizes{5}{5}{5}{5}
\DeclareMathSizes{6}{6}{5}{5}
\DeclareMathSizes{7}{7}{5}{5}
\DeclareMathSizes{8}{8}{6}{5}
\DeclareMathSizes{9}{9}{6}{5}
\DeclareMathSizes{\@xpt}{\@xpt}{7}{5}
\DeclareMathSizes{\@xipt}{\@xipt}{8}{6}
\DeclareMathSizes{\@xiipt}{\@xiipt}{8}{6}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xpt}{7}
\DeclareMathSizes{\@xviipt}{\@xviipt}{\@xiipt}{\@xpt}
\DeclareMathSizes{\@xxpt}{\@xxpt}{\@xivpt}{\@xiipt}
\DeclareMathSizes{\@xxvpt}{\@xxvpt}{\@xxpt}{\@xviipt}


This means that when the font size is 10, the normal math is in 10pt size, first level subscripts (and superscripts) 7pt and second level subscripts (and superscripts) 5pt.

You can change this setting in your preamble, for instance

\makeatletter
\DeclareMathSizes{\@xpt}{\@xpt}{6}{5}
\makeatother


so that $s_{A}$ would give

You have to modify all entries relative to the point sizes you're effectively using. It's best to load \usepackage{lmodern} if you want to give fractional sizes (or the fix-cm package).

There's another trick worth noting: one can shift a bit down a subscript by inserting an empty superscript. Here's the result of $s_{A}\,s^{}_{A}$

And here is what is obtained adding the previous change with \DeclareMathSizes

One can perform this automatically by loading the subdepth package.

-
Thanks a lot! Would \makeatletter \DeclareMathSizes{\@xpt}{\@xpt}{6}{5} \makeatother changes the font size of all first-level subscripts? I would like to have the lowercase ones unchanged but only scale the uppercase ones down. –  braids Jun 1 '12 at 16:36
All subscripts would be changed. There might be a way, but making it cooperate with the LaTeX infrastructure would require some months' work. But I can't consider it a real solution, particularly if there are many subscripts of different case. –  egreg Jun 1 '12 at 16:47
I see. Thanks for the help! –  braids Jun 1 '12 at 16:53

The answer from ( http://www.latex-community.org/forum/viewtopic.php?f=5&p=4872 )works for me:

=================== Re: Can I have more control over my subscripts? Postby ptoche on Thu Aug 7th, 2008

Great tip.

My contribution is absolutely trivial:

In preamble, define: \newcommand{\ms}{\scriptscriptstyle}

In text, type: {\ms TEXT}

where "ms" stands for "math small"

it's just less tedious to type {\ms TEXT} instead of {\scriptscriptstyle TEXT}

-
Welcome to TeX.SE. How does your contribution answer the original query, which was about affecting the size of subscript material that consists of uppercase letters? –  Mico Apr 11 at 18:02

Here are some examples of different s_A subscripts and s_a as a reference:

\documentclass{article}
\usepackage{relsize}
\usepackage{lmodern}
\usepackage{slantsc}
\begin{document}
\begin{displaymath}
s_{\textsc{a}}
s_{\textsc{\textsl{a}}}
s_{\textsc{\relsize{-2}{\textsl{a}}}}
s_A
s_{\!\mathsmaller{A}}
s_{\!_A}
s_a
\end{displaymath}
\end{document}


\newcommand{\l}[1]{_{\!\mathsmaller{#1}}}

You need the relsize package for this.