7

When I write something like

$\mathrm{C}^*$-algebra

for a C*-algebra, the space between * and - is too large. How do I change this? Are there general criteria on how much such space should be shrinked?

  • You can manually insert \! in mathmode for a small negative space. – Steven B. Segletes Jul 22 '13 at 14:00
  • Thanks! How do I know this is the "right" amount of negative space? (Or do I have to estimate on my own?) – Deniz Jul 22 '13 at 14:07
  • It's subjective in a case like this... just be consistent. – Steven B. Segletes Jul 22 '13 at 14:13
9

Here's an analysis of what happens:

\documentclass[10pt]{article}
\usepackage{tabularx}
\usepackage[table]{xcolor}

\setlength{\fboxrule}{0.1pt}
\setlength{\fboxsep}{-\fboxrule}

\begin{document}
$\mathrm{C}^*$-algebra

\fbox{$\mathrm{C}^*$}-algebra

\fbox{$\mathrm{C}^{\fbox{$\scriptstyle*$}}$}-algebra

\begin{tabular}{@{}ll}
\fbox{$\mathrm{C}^*$}\kern-.1ex-algebra &
$\mathrm{C}^*$\kern-.1ex-algebra \\
\fbox{$\mathrm{C}^*$}\kern-.15ex-algebra &
$\mathrm{C}^*$\kern-.15ex-algebra \\
\fbox{$\mathrm{C}^*$}\kern-.2ex-algebra &
$\mathrm{C}^*$\kern-.2ex-algebra \\
\fbox{$\mathrm{C}^*$}\kern-.25ex-algebra &
$\mathrm{C}^*$\kern-.25ex-algebra \\
\fbox{$\mathrm{C}^*$}\kern-.3ex-algebra &
$\mathrm{C}^*$\kern-.3ex-algebra \\
\end{tabular}
\end{document}

enter image description here

The first three rows show the normal typesetting, which I don't find really bad, but it's subjective. The following rows show the same with increasing amount of (negative) kerning; on the left you can see the relation of the hyphen with the bounding box of “C*”. When you have decided the right amount, do

\newcommand{\csalg}{$\mathrm{C}^*$\kern-.1ex-algebra}

and type \csalg{} when you want to use the term. Choose the name you prefer, of course. It's probably worthy defining it even if you eventually decide for no kerning.

| improve this answer | |
  • Has there ever been attempts to add automatic kerning between math and text? I especially don’t like the looks of $K$-algebra and vector space over~$K$.. Especially the extra space to the between the K and the dot is annoying to look at. The only automatic solution I have found so far is to make a callback in LuaTeX to test for specific combinations. – Gaussler Jun 1 '16 at 18:18
  • @Gaussler TeX doesn't provide anything for this. – egreg Jun 1 '16 at 18:24
6

This answer presents two other ideas:

Protruding value of package microtype

The TeX engine pdfteX supports a feature "character protrusion". Certain characters (e.g. -, ., ,) are allowed to move into the margins. This can improve the visual smoothness of the margins.

Macro \leftprotrude grabs the next character and looks at its value for the protrusion into the left margin. \lpcode<font><character slot> expands to an integer number, the unit is a per mill of 1em.

Package microtype enables character protrusion and configures some values for the protrusion (they are font-dependent).

Vertical position of the star

For fun, the example also shows some alternatives:

  • Text mode: \textsuperscript{*}
  • Math mode: star set as limit of an operator (\mathop).

Example

\documentclass{article}

\usepackage{microtype}
\newcommand*{\leftprotrude}[1]{%
  \begingroup
    \leavevmode
    \kern-.001\dimexpr\numexpr(\lpcode\font`#1)em\relax
  \endgroup
  #1%
}

\newcommand*{\CalgA}[1]{%
  \mbox{$\mathrm{C}^{*}$#1-algebra}%
}
\newcommand*{\CalgB}[1]{%
  \mbox{$\mathop{\mathrm{C}}\nolimits^{*}$#1-algebra}%
}
\newcommand*{\CalgC}[1]{%
  \mbox{C\textsuperscript{*}#1-algebra}%
}

\begin{document}
\begin{tabular}{l@{}|l@{}|l@{}|l}
  \CalgA{} & \CalgB{} & \CalgC{} & \small(unmodified) \\
  \CalgA{\leftprotrude} & \CalgB{\leftprotrude} & \CalgC{\leftprotrude}
    & \small\verb|\leftprotrude| \\
  \CalgA{\negthinspace} & \CalgB{\negthinspace} & \CalgC{\negthinspace}
    & \small\verb|\negthinspace| \\
\end{tabular}
\end{document}

Result

| improve this answer | |

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.