1

When using a bar over a letter in math mode and then having certain calligraphic letters in superscript, the letters overlap with the bar or are at least very close to the letter with the bar. This looks somewhat ugly.

Example:

\documentclass{article}

\begin{document}
    \begin{equation}
        \bar{d}^{\mathcal{H}}_{hewt}
    \end{equation}
    \begin{equation}
        \bar{d}^{\mathcal{C}}_{hewt}
    \end{equation}
\end{document}

Example image showing insufficient spacing for calligraphic superscript

I am using this notation throughout my document. While I realize that I could add a small space using \,, I would prefer not having to alter this everywhere. Is there a solution which changes the space for all calligraphic superscript letters?

1
  • There are solutions, but the simpler one is to make macros. What does \mathcal{H} or \mathcal{C} stand for? Are they used in other places other than superscripts? As an example if \bar{d}^{\mathcal{H}} is a common occurrence, you could define \def\dH#1{\bar{d}^{\,\mathcal{H}}_{\mathrm{#1}}} and then use \dH{hewt}. Also what does hewt stand for? May be you should write it upright?
    – Manuel
    Apr 6, 2018 at 9:20

3 Answers 3

2

This assumes that calligraphic letters, when used in superscripts (or subscripts) are at the beginning of the superscript.

I insert two glob of glue that, in text or display style, cancel each other; in script style, \nonscript nullifies the first negative spacing, leaving only the positive one. The \calsym command has two arguments, the first one used for fine tuning the spacing.

From the example it seems better to add the kern also when the base letter doesn't wear an accent.

\documentclass{article}
\usepackage{amsmath} % recommended

\newcommand{\calsym}[2]{\nonscript\mspace{-#1mu}\mspace{#1mu}\mathcal{#2}}
\newcommand{\cC}{\calsym{2}{C}}
\newcommand{\cH}{\calsym{3}{H}}

\begin{document}

\begin{gather}
\bar{d}^{\cH}_{\mathrm{hewt}}+d^{\cH}
\\
\bar{d}^{\mathcal{H}}_{\mathrm{hewt}}+d^{\mathcal{H}}
\\
\bar{d}^{\cC}_{\mathrm{hewt}}+d^{\cC}
\\
\bar{d}^{\mathcal{C}}_{\mathrm{hewt}}+d^{\mathcal{C}}
\\
a\cH\cC
\\
a\mathcal{H}\mathcal{C}% for checking
\end{gather}

\end{document}

enter image description here

1

Just an idea ---in case you haven't think about it--- is to define a command:

\documentclass{article}

\newcommand\mybar[3][\empty]{\bar{#2}^{\,\mathcal{#3}}\ifx#1\empty\relax\else_{#1}\fi}

\begin{document}
    \begin{equation}
        \bar{d}^{\mathcal{H}}_{hewt}
    \end{equation}
    \begin{equation}
        \bar{d}^{\mathcal{C}}_{hewt}
    \end{equation}
        \begin{equation}
        \mybar[newt]{d}{H}=1
    \end{equation}
    \begin{equation}
        \mybar[newt]{d}{C}=1
    \end{equation}
        \begin{equation}
        \mybar{d}{J}=1
        \end{equation}
\end{document}

I used the subscript as an optional first argument, but you can use just the idea the way you like:

enter image description here

0

This is an ugly hack, and I won't recommend it in general. But if it works in your document without unwanted side effects, it's an easy way to get what you want:

\documentclass{article}
\usepackage{etoolbox}
\pretocmd{\mathcal}{\mathchoice{}{}{\,}{\,}}{}{}
\begin{document}
    \begin{equation}
        \bar{d}^{\mathcal{H}}_{hewt}
    \end{equation}
    \begin{equation}
        \bar{d}^{\mathcal{C}}_{hewt}
    \end{equation}
\end{document}

Likely unwanted side effects: It applies in subscripts as well as superscripts. And in the numerators and denominators of text style fractions. And in superscripts where the calligraphic letter is not the first symbol. That's a lot of potential problems!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .