The Problem lies within the definition of \textsuperscript
that uses math mode.
\DeclareRobustCommand*\textsuperscript[1]{%
\@textsuperscript{\selectfont#1}}
\def\@textsuperscript#1{%
{\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
A possible workaround is redefining the actual command so that it will not get in the way with your equations, this needs graphicx
:
\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\scalebox{0.66}{#1}}}
Or this needs relsize
\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\smaller{#1}}}
I admit that this is just an easy workaround emulating the typrsetting of superscripts. It might be possible, that modern typography defines super/subscript in a certain way.
This also works with various enlargements of text sizes. This MWE also emulates a textsubscript:
\documentclass[12pt,oneside,letterpaper,titlepage]{article}
\DeclareMathSizes{12}{20}{14}{10}
%% Solution 1
\usepackage{relsize} %smaller
\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\smaller{#1}}}
\newcommand{\textsubscript}[1]{\raisebox{-0.4ex}{\smaller{#1}}}
%% Solution 2
%%\usepackage{graphicx} %scalebox
%%\renewcommand{\textsuperscript}[1]{\raisebox{0.8ex}{\scalebox{0.66}{#1}}}
%%\newcommand{\textsubscript}[1]{\raisebox{-0.4ex}{\scalebox{0.66}{#1}}}
\begin{document}
...modulation by Ca\textsuperscript{2+}...
...soluted in water H\textsubscript{2}O...\\
\tiny Ca\textsuperscript{2+}
\scriptsize Ca\textsuperscript{2+}
\footnotesize Ca\textsuperscript{2+}
\small Ca\textsuperscript{2+}
\normalsize Ca\textsuperscript{2+}
\large Ca\textsuperscript{2+}
\Large Ca\textsuperscript{2+}
\LARGE Ca\textsuperscript{2+}
\huge Ca\textsuperscript{2+}
\Huge Ca\textsuperscript{2+}
\normalsize
\begin{equation}
\sigma^2 = iI - \frac{I^2}{N}
\end{equation}
\end{document}
Further reading relsize and graphicx.
For chemistry typesetting (I guessed that on the calcium bit) there are some packages available, like bpchem or mhchem, that handle formulas quite well.
I would avoid a math alphabet for this.
\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{fixcmex}
\usepackage{microtype}
\DeclareFontFamily{U}{BOONDOX-calo}{\skewchar\font=45 }
\DeclareFontShape{U}{BOONDOX-calo}{m}{n}{
<-> s*[1.05] BOONDOX-r-calo}{}
\DeclareFontShape{U}{BOONDOX-calo}{b}{n}{
<-> s*[1.05] BOONDOX-b-calo}{}
\DeclareRobustCommand{\scrvar}[1]{%
\text{\textls[-100]{\usefont{U}{BOONDOX-calo}{m}{n}#1}}%
}
\DeclareMathAlphabet{\mathsfbf}{\encodingdefault}{\sfdefault}{b}{n}
\newcommand{\Hilbs}{\scrvar{Hilb}}
\newcommand{\Hilbr}{\mathrm{Hilb}}
\newcommand{\Scheme}{\mathsfbf{Scheme}}
\newcommand{\Set}{\mathsfbf{Set}}
\newcommand{\op}{^{\mathrm{op}}}
\DeclareMathOperator{\Hom}{Hom}
\begin{document}
Hilbert functor $\Hilbs_X\colon \Scheme\op \to \Set$ s.t.\@ for $U \in \Scheme$,
we have $\Hilbs_X(U) = \Hom(U, \Hilbr_X)$.
\end{document}
Best Answer
To expand on David's answer, what
\DeclareMathSizes
does is define a macroS@XX
whereXX
is the current type size in points, e.g.,(I've modified spaces and line breaks from the output of
\meaning
for the sake of clarity).This means that if you want to see what the sizes are, you can just look at the values of those macros and, in fact that's exactly what happens in the definition of the LaTeX macro:
But you want to change this locally. For this, there is a sneaky way to do it. We can't sprinkle
\DeclareMathSizes
around the document since it's preamble-only, but we can create a new type size that's slightly off³,⁴ from the normal typesize and use that.In the preamble:
Then we can write (but this is best in a command or environment):
Now as for why this is all so weird, it comes down to the fact that math fonts and text fonts are treated distinctly in the underlying TeX engine. In text, it's enough to invoke a control sequence that loaded a font with
\font
, so in plain TeX,\fiverm
selects cmr5 or in LaTeX\OT1/cmr/m/n/10
selects cmr10. But font selection in math mode is handled via families instead of the text font selection, which is why\mathbf{+}
does not give a bold +. This parallel-universe font selection also applies to size changes which are restricted to the\displaystyle
,\textstyle
,\scriptstyle
and\scriptscriptstyle
commands. You really would need to read the relevant chapters of The TeXbook to get a full picture of how this works.For all the hyperrationality of Lamport's user interface in designing LaTeX, I curse that he followed Knuth's lead in randomly sprinkling
@
in different places in private macro names. This is one of the biggest plusses of ExpL3 to me. Finally some Teutonic organization applied to the naming conventions.²Us older folks will remember the inscrutable names that were used in the Bitnet/EARN days for German and Austrian host names which, while they looked like a cat sat on the keyboard when it was time to pick a hostname were actually a mapping of key information about each host into the available 8 characters for a hostname.
The variation in size here is miniscule, 0.001% which means that, for example, the amount of space that a lowercase m in cmr10 takes up will increase from 8.33336pt to 8.3334433336pt, a difference of about 5.5sp=.03μm so we're looking at molecular-scale dimensions here.
Although this is moot with Computer Modern since NFSS will switch to cmr10 at 10pt anyway. In XeLaTeX and LuaLaTeX, though, since they're using lmr instead of cmr, they'll happily request a 10.0001pt font.