# Superscript variable size - how to style? [fixltx2e]

When using \superscript{number}, the distance between the character on the left and the superscript-ed character depends on the character in the superscript. As can be seen in the image, "1", "2", and "3" are much farther than the other letters from the character to the left.

I would like to have all superscript-ed numbers be as close to the character to the left as "0", for example, is. Is this possible?

Bonus question: Why does the position of the subscripted character not change, as it does for superscripted characters?

here is my TeX code:

\documentclass{report}

% Add the ability to display 汉字 and English
\usepackage[UTF8]{ctex}
\usepackage[utf8]{inputenc}
% Add the ability to write pinyin with tones
\usepackage{xeCJK}
\usepackage{xpinyin}
\usepackage{fancyhdr}
% Add the ability to use Lorem Ipsum placeholder text
\usepackage{lipsum}
\usepackage{xcolor}
% Add the ability to align text
\usepackage{setspace}
\usepackage{sectsty}
% Add the ability to underline
\usepackage[normalem]{ulem}
% Make "" switch to opposing quotation marks intelligently
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}
% Add the ability to give underlines a colour, and its thickness
\usepackage{color,soul}
\definecolor{darkblue}{rgb}{0,0.8,0.2}
\setulcolor{darkblue}
\setul{0.5ex}{0.4ex}
% Add the ability to use graphics
\usepackage{graphicx}
% Add the ability to indented paragraphs
\usepackage{indentfirst}

\pagestyle{fancy}
\chapterfont{\centering}
%\fancyfoot[C]{Footer}% \fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{0.4pt}

\begin{document}

\setstretch{2.0}

\end{document}


TeXstudio, built with XeLaTeX

• Please make your example compilable (documentclass, needed packages, ...). – TeXnician Jul 15 '17 at 15:54
• you have tagged your question as latex3 and fixltx2e but are you using either of those packages? how are you setting the text at all? using inputenc and pdftex pr xetex or luatex? Please make your example a complete small document that people can run to see the problem. the spacing is font dependent but you have not said what font you are using or shown the code you used to set up the fonts. – David Carlisle Jul 15 '17 at 16:41
• I can't reproduce with \begin{document} \newcommand*\test[1]{X\textsubscript{#1} X\textsuperscript{#1}\par} \test{0}\test{1}\test{2}\test{3}\test{4}\test{5}\test{6}\test{7}\test{8}\test{9} \end{document}, for example, compiled with pdfTeX. – cfr Jul 15 '17 at 16:50
• BTW, the commas are mixed up: U+002c (COMMA) and U+FF0C (FULLWIDTH COMMA). – Heiko Oberdiek Jul 15 '17 at 16:56
• How did you find out that the commas are different? – Idios Jul 15 '17 at 19:21

The superscripts 1, 2, and 3 look smaller than the other superscripts. My guess is that the implementation \textsuperscript of your document maps these characters to the real superscripts U+00B2 (SUPERSCRIPT TWO), U+00B3 (SUPERSCRIPT THREE), and U+00B9 (SUPERSCRIPT ONE). The other superscripts and subscripts are just the ASCII letters in smaller size raised or lowered.

The \textsuperscript from the LaTeX kernel does not have the special treatment. Maybe, it's a package that redefines \textsuperscript. And maybe, the space is caused by a bug in the implementation (most likely an unwanted space by a line end).

# Update

The now provided example in the question uses XeTeX with uses packages that loads package xunicode. This package tries to find real superior glyphs and uses them instead of the "faked" superscripts. The font used for the Latin text is Latin Modern. It does only provides superior glyphs for 1, 2, and 3; the font does not have inferior glyphs.

A workaround is to disable the internal commands that stand for the text superscript glyphs for 1, 2, and 3:

% arara: xelatex
\documentclass{report}
\pagestyle{empty}

\usepackage{xeCJK}

% Patch for disabling using real superior glyphs
% for superscripts 1, 2, and 3.
\newcommand*{\DeactivateSuperscript}[1]{%
\expandafter\let
\csname\string\EU1\string\textsuperscript-#1\endcsname\relax
}
\DeactivateSuperscript{1}
\DeactivateSuperscript{2}
\DeactivateSuperscript{3}

\begin{document}
\noindent

\end{document}


The space came from \CJKecglue, which seems to be inserted between CJK and Western text. As real superior glyphs, U+00B2, U+00B3, constitute U+00B9 such Western text, whereas the other superscripts are constructed with the math subscript operation, thus the math mode prevents the insertion of \CJKecglue.

• I added my code to the question. Hope it helps diagnose the problem! – Idios Jul 15 '17 at 19:12