3

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?

Superscript position depends on character displayed.

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}
% Add the ability to create fancy headers and footers
\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}
%\fancyhf{}% Clear header/footer
%\fancyhead[C]{Header}
%\fancyfoot[C]{Footer}% \fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}


\begin{document}

\setstretch{2.0}

但是\textsuperscript{0}, 但是\textsubscript{0},\\
但是\textsuperscript{1}, 但是\textsubscript{1},\\
但是\textsuperscript{2}, 但是\textsubscript{2},\\
但是\textsuperscript{3}, 但是\textsubscript{3},\\
但是\textsuperscript{4}, 但是\textsubscript{4},\\
但是\textsuperscript{5}, 但是\textsubscript{5},\\
但是\textsuperscript{6}, 但是\textsubscript{6},\\
但是\textsuperscript{7}, 但是\textsubscript{7},\\
但是\textsuperscript{8}, 但是\textsubscript{8},\\
但是\textsuperscript{9}, 但是\textsubscript{9},\\



\end{document}

TeXstudio, built with XeLaTeX

  • 1
    Please make your example compilable (documentclass, needed packages, ...). – TeXnician Jul 15 '17 at 15:54
  • 1
    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
  • 1
    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
4

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
但是\textsuperscript{0}, 但是\textsubscript{0},\\
但是\textsuperscript{1}, 但是\textsubscript{1},\\
但是\textsuperscript{2}, 但是\textsubscript{2},\\
但是\textsuperscript{3}, 但是\textsubscript{3},\\
但是\textsuperscript{4}, 但是\textsubscript{4},\\
但是\textsuperscript{5}, 但是\textsubscript{5},\\
但是\textsuperscript{6}, 但是\textsubscript{6},\\
但是\textsuperscript{7}, 但是\textsubscript{7},\\
但是\textsuperscript{8}, 但是\textsubscript{8},\\
但是\textsuperscript{9}, 但是\textsubscript{9},\\
\end{document}

Result

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.