# DeclareMathOperator and widearcarrow with kpfonts

The title says it all, I am using the package kpfonts and I would like to declare a math operator that has a widearc on top. However, when I compile I don't get any arc.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{
kpfonts
}

\DeclareMathOperator{\dSing}{\widearcarrow{Sing}}
\DeclareMathOperator{\sSing}{\widehat{Sing}}
\begin{document}
$\dSing(X) \quad \widearcarrow{Sing}\quad\sSing(A)$
\end{document}


Notice that the command widehat is working.

• Welcome to TeX.SE. – Mico Aug 11 '19 at 18:49
• Thanks @Mico and thanks everybody for your answers! – Stefano Nicotra Aug 12 '19 at 9:23

Apparently, math accents from family 3 don't work in \operatorname.

You can use a lower level interface:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{kpfonts}

\DeclareRobustCommand{\dSing}{%
\mathop{\widearcarrow{\mathrm{Sing}}}\nolimits
}
\DeclareMathOperator{\sSing}{\widehat{Sing}}

\begin{document}

$\dSing(X) \quad \widearcarrow{Sing} \quad \sSing(A)$

\end{document}


Replace \newcommand instead of \DeclareMathOperator and your code works perfectly.


\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{kpfonts}
\newcommand{\dSing}{\widearcarrow{\mathrm{Sing}}}
\newcommand{\sSing}{\widehat{\mathrm{Sing}}}
\begin{document}
$\dSing(X) \quad \widearcarrow{Sing}\quad\sSing(A)$
\end{document}

• Good answer! One tweak: if you redefine the operator font or \mathrm, so that they’re no longer the same, you can replace \mathrm{Sing} with \operatorname{Sing}. – Davislor Aug 12 '19 at 3:57
• @Davislor I thank you and all of you from the bottom of my heart. I've only had luck :-) – Sebastiano Aug 12 '19 at 6:53
\renewcommand{\d}[1]{\widearcarrow{\text{#1}}}
\def\dSing{\d{Sing}}


Don't know why it works this way, but it does. May be a feature of the definition of widearcarrow in the package.