6

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}

enter image description here

Notice that the command widehat is working.

Thanks for your help!

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

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}

enter image description here

7

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

For the differences between \newcommandand \DeclareMathOperator I suggest to see this link: newcommand vs. DeclareMathOperator

enter image description here

\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}
  • 3
    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 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 at 6:53
4
\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.

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.