# Overline in operator messes spacing

I wish to define an operator, something like:

\DeclareMathOperator{\St}{\overline{St}}


It works partially, however the spacing between the operator and the next symbol disappears.

May I ask how to correct this? I tried doing:

\DeclareMathOperator{\St}{\mathop{\overline{St}}}


enclosing a \mathop as suggested in Why does \overline mess up the spacing?. However, it doesn't seem to work in this context.

Thanks for any help.

Update: Sorry, my bad, I put a curly bracket {\St} in my code, which causes the spacing to disappear. Removing the curly bracket solves the issue.

• @David There remains a spacing issue between the operator and a superscript. – Heiko Oberdiek Dec 18 '17 at 19:09
• @HeikoOberdiek there are any number of issues not mentioned in the question in code that isn't shown:-) But no matter now you've answered the close vote can be ignored (I'll delete the close comment) – David Carlisle Dec 18 '17 at 19:12

The subscript seems fine. But the superscript is pretty close to the line. The line can be shortened:

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator{\StA}{\overline{St}}

% Line shortened by \thinmuskip
\DeclareMathOperator{\StC}{\overline{St\!}\,}

% Line shortend by .5\thinmuskip
\DeclareMathOperator{\StB}{%
\overline{St\mskip-.5\thinmuskip}\mskip.5\thinmuskip
}

\begin{document}
$\StA_{0}^{n}\; \StB_{0}^{n}\; \StC_{0}^{n}$
\end{document}


The middle version \StB seems acceptable.