Unsightly space in math prefix

Up until now, I've been formatting the phrase "C*-algebras" in TeX using

$C^*$-algebras


but this leaves an unsightly space between the star(*) and the hyphen (I suppose because of the switch from math mode?).

Is there a standard way of typesetting such mathematical "prefixes"?

• (1) welcome, (2) please provide a full minimal example. I see no space issues from just adding this to a naïve doc. And our researchers who deals with $C^*$ stuff write it just this that. – daleif Jun 8 '18 at 12:51
• Do you prefer \newcommand\Calgebra{\textit{C}\textsuperscript{*}-algebra}? – Davislor Sep 3 '19 at 9:30

You can reduce the space but I'm not sure it's an improvement:

\documentclass{article}
\showoutput
\begin{document}

$C^*$-algebras

$C^*\!$-algebras

\end{document}

• I agree with your assessment (that it may not be an improvement). If the OP wants, they can try something like $C^*$\kern-.07em-algebras which will allow them to tweak the spacing until it looks exactly how they want it to. This may lead one to insanity. – banbh Jun 8 '18 at 14:39
• Why not include the negative space in the superscript -- $C^{*\!}$-algebras? – barbara beeton Sep 3 '19 at 14:01
• @barbarabeeton well that gives a smaller negative space, it just depends which you prefer I suppose – David Carlisle Sep 3 '19 at 14:15
• You might consider coding this with \nobreakdash because a line break really isn't wanted between $C*$- and algebras. (requires amsmath) – barbara beeton Apr 30 at 18:04
• @barbarabeeton well it's like x-ray if it was a choice of breaking somewhere, or going overfull and sticking in the margin, breaking after C*- wouldn't be so bad would it? – David Carlisle Apr 30 at 18:33

The best solution is always the simplest. In this case, a kern to tighten it up just enough:

$C^*$\kern-1pt-algebras

I wouldn't use any skip such as \! here, as that strikes me as a botch. Similarly, pt is the right unit to be using here.

The extra space is due to TeX enclosing C^* in a box without any information as to its visual shape. That's just how TeX rolls, no matter whether it is setting mathematics or text.

As regards macros, I'd probably write \Cstar-algebras or \Cstar algebras:

\def\pinch{\kern-1pt} \def\Cstar{$C^*$\pinch-}

I would never write "algebras" into a macro, instead writing that after a macro for the rest.

These solutions are adapted from the TeXbook.