I'm busy answering a question by constructing a new math operator that uses the sum symbol and some TikZ placed on top. My answer as it stands can be found here. It looks (I think) pretty good in display style, but too large when shown inline. Even if it automatically set the sum symbol into inline size, the placement of the TikZ would be off.
Is there a way to define different code for when the operator is used in display mathematics environments, and when it's inline? Alternatively, is there a way to detect when you are in display or inline mode?
From the aforementioned example, here is the code I constructed:
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{tikz}
% Modify the coordinate (-0.3ex,0) to adjust alignment, and (0.1) to adjust the size.
\DeclareMathOperator*{\osum}{\ensuremath{
\begin{tikzpicture}[baseline=(char.base), inner sep=0, outer sep=0]
\draw (-0.3ex,0) circle (0.1);
\node (char) at (0,0) {$\displaystyle\sum$}; % Want to define a second symbol for inline...
\end{tikzpicture}}%
}
\begin{document}
\[
G=\osum_a^b H
\]
And now in inline mode the equation $G=\osum_a^b H$ is obviously too big.
\end{document}