# Make superscript size smaller (always)

How would you implement the "catcode" solution here for superscripts? Thanks

EDIT

The code below reproduces the error (complied using XeLaTeX). Works if the following two lines are commented out:

\catcode^=\active
\newcommand^[1]{\ensuremath{\sp{\scriptscriptstyle #1}}}


Full code:

\documentclass[11pt,english,no-math]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Calibri}
\usepackage{geometry}
\geometry{verbose,tmargin=0.8in,bmargin=0.8in,lmargin=0.8in,rmargin=0.8in}

\catcode_=\active
\newcommand_[1]{\ensuremath{\sb{\scriptscriptstyle #1}}}

\catcode^=\active
\newcommand^[1]{\ensuremath{\sp{\scriptscriptstyle #1}}}

\usepackage[dvipsnames]{xcolor}

\usepackage{titlesec}
\titleformat*{\section}{\LARGE\bfseries\color{RoyalBlue}}
\titleformat*{\subsection}{\Large\bfseries\color{RoyalBlue}}

\usepackage{xunicode}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\begin{document}

\section{Set up}

\begin{align*}
\int_{n-1}^{n}c_{n}dt & =x\left(i,n\right)\\
\implies c_{n} & =x\left(i,n\right)
\end{align*}

\end{document}

• just copy the code replacing _ by ^ and \sb by \sp – David Carlisle Jan 30 '18 at 1:49
• Thanks, David. I did that, but it didn't work for some reason. \catcode^=\active \newcommand^[1]{\ensuremath{\sp{\scriptscriptstyle #1}}} – gsab Jan 30 '18 at 1:53
• if you want help with an error message the question is always clearer if it includes a complete test document that produces the error and the exact error message you got. "did not work" is hard to debug. – David Carlisle Jan 30 '18 at 1:57
• What's the error message? – cfr Jan 30 '18 at 2:19
• ! Missing number, treated as zero. <to be read again> \protect l.1455 \XC@catcodes – gsab Jan 30 '18 at 2:24

\catcode^=\active

This means that xcolor.sty is processed with the new catcode for ^ (not something it is prepared for), which can lead to undesirable results. Similar problems with having this redefinition before \usepackage{xunicode}.
Move these \catcode-changing lines to after all external files have been loaded. Say, just before or after \begin{document}`. Then the error goes away.