\textsuperscript does not work

superscripts

I am writing my thesis using a template and have a problem with the function \textsuperscript. For whatever reason it is not working and instead it writes "germanb".

I mean, if I write in latex 10\textsuperscript{2} km\textsuperscript{2} the processed text reads "10germanb2 kmgermanb2".

Has anyone seen this before? Is there a solution or another command? I don't want to change all superscripts to equations.

Best Answer

This document

\documentclass{article}

\usepackage[german]{babel}

\renewcommand\textsuperscript{\tmpa}

\begin{document}

10\textsuperscript{2} km\textsuperscript{2}

\end{document}

produces the output shown:

enter image description here

The bad line may not be quite so explicit in your case, but buried in a package, but you could debug by adding lines as follows:

\typeout{1: \meaning\textsuperscript}
\documentclass{article}
\typeout{2: \meaning\textsuperscript}
\usepackage[german]{babel}
\typeout{3: \meaning\textsuperscript}
\renewcommand\textsuperscript{\tmpa}
\typeout{4: \meaning\textsuperscript}

\begin{document}

\typeout{5: \meaning\textsuperscript}
10\textsuperscript{2} km\textsuperscript{2}

\end{document}

this makes the same typeset output but the terminal and log show:

1: macro:->\protect \textsuperscript  
2: macro:->\protect \textsuperscript  
3: macro:->\protect \textsuperscript  
4: \long macro:->\tmpa 

which clearly shows that \textsuperscript went wrong between the 3rd and 4th \typeout