I wrote the following macro, that prints C_0^*. But I wanted to push the position of * little high, hence used strut. I also wanted optional argument i.e. C^* and C_0^* can be handled by same macro. So, I defined the following:
\documentclass{article} \newcommand{\objstylesf}[1]{\ensuremath{\mathsf{#1}}} \newcommand{\chcpcti}[1][]{ \ifx& \objstylesf{C}\strut^{\hspace{-.8pt}*} \else \objstylesf{C}_{#1}\strut^{\hspace{-5pt}*} \fi } \begin{document} $\chcpcti$ $\chcpcti[0]$ $\chcpcti[1]$ $\chcpcti[\ell+1]$ \end{document} For first three, it is working fine. However, for the last one, the * is shifted quite a lot. Anything hardcoded (such as -17pt) hampers the others.
Precisely, I need an input length sensitive optional argument macro definition. Can anyone please help me? I would like to keep the strut there. Or some other way of handling the superscript position might also be fine. But I don't like the default superscript position in this case.
