# How to add a superscript in text mode

I'm writing about C* algebras and I'm trying to write *-strings efficiently. I managed to define C* like this:

\newcommand{\Cstar}{C\textsuperscript{*}}


While I have to invoke it as \Cstar{} to prevent it from sticking to the next word, I have had trouble writing a command to add * to any word (such as morphism or isometry). I tried doing this:

\newcommand{\star}[1]{#1\textsuperscript{*}}


without luck. Is this possible, and should I be doing this with LaTex, or is it something I should be doing with my editor's macros?

• Welcome to TeX.SX! Note that it is usually best practice here to include a small example document that does only include the bare necessities to show what you're trying so far (e.g. \documentclass{article}\newcommand\star[1]{#1\textsuperscript{*}}\begin{document}\star{Foo}\end{document} would suffice here). – Skillmon Apr 8 at 19:59
• The command \star is already defined in LaTeX. You can try \Star instead. – Phelype Oleinik Apr 8 at 20:00

## 1 Answer

In my opinion, the asterisk should be always in the upright font, independently of the context. Besides, \textsuperscript{*} would place the asterisk too high, see the last line in the image below.

Also C* should probably always appear upright, but you may decide otherwise.

Redefining \star could be safe in your context, but be aware that \star is the name of a symbol, namely ⋆, and you may want to save it under another name in case you decide to use it.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\Star}[1]{#1\ensuremath{^*}\kern-\scriptspace}
\newcommand{\CStar}{\Star{\ensuremath{\mathrm{C}}}}

\begin{document}

% the commands in upright text
We deal with \CStar-algebras, with \Star{morphisms}
and \Star{isometries}.

% the commands in italics context, such as theorems
\textit{We deal with \CStar-algebras, with \Star{morphisms}
and \Star{isometries}.}

% with \textsuperscript{*}
\textit{We deal with C\textsuperscript{*}-algebras, with morphisms\textsuperscript{*}
and isometries\textsuperscript{*}.}

\end{document}


• Thank you, the upgright text is just what I was looking for. – user20402 Apr 8 at 21:09