I'm using pdftex and I want to define a command for the typesetting of quantum mechanical operators that produces upright letters with a
\hat accent. The problem is that the obvious solution
does only work for roman letters but I also use at least one operator that should be represented by a greek letter for which the \mathrm command produces rubbish output. So it would be nice to define a command that distinguishes between greek and roman letters via an if statement. Since I have very little experience with TeX I don't really know how to tackle this problem.