# Problem redefining hat accent in eulerpx

I want to use eulerpx with the alternative hat accent provided by eulervm (via the euler-hat-accent option). To this end, I copied the relevant commands from eulervm.sty (see also this answer). The problem is that the redefinition messes with parentheses:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools,newpxtext,eulerpx}
\DeclareSymbolFont{symbols}{U}{zeus}{m}{n}
\DeclareMathAccent{\hat}{\mathalpha}{symbols}{222}

\begin{document}

$\hat{a}\qquad(b)$

\end{document}


Without the redefinition of the hat accent (DeclareSymbolFont,DeclareMathAccent) the output is as expected: no omitted parentheses and no extra colon, but of course the modified hat is not obtained.

Am I redefining the hat accent in a wrong way? Is there a way to avoid this strange behavior?

Your first command \DeclareSymbolFont{symbols}{U}{zeus}{m}{n} defines the math symbol family symbols, but eulerpx already defines a symbol family with this name, so you overwrite it. But this is the family where the parentheses come from, so they are replaced with the symbols the new symbols font provides in the respective positions, for example the colon. You can fix this by choosing another name for the family:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools,newpxtext,eulerpx}
\DeclareSymbolFont{zeussymbols}{U}{zeus}{m}{n}
\DeclareMathAccent{\hat}{\mathalpha}{zeussymbols}{222}

\begin{document}

$\hat{a}\qquad(b)$

\end{document}


Relatedly, the closest equivalent of eulerpx in the modern toolchain is to \usepackage[math-style=upright]{unicode-math} with Palatino or a clone such as Pagella as the Roman font, optionally Optima or a clone such as Classico as the sans-serif font, a newpx clone such as Asana as the main math font, and then portions of Neo Euler.

The following loads all the combining accents from Neo Euler in math mode:

\setmathfont[Scale = MatchLowercase,
range={up,bfup,cal,bfcal,frak,bffrak,
"0301-"030F,"0311,"0323-"0325,"032E-"0332,"033B}
]{euler.otf}