I'd like to apply different styles depending on the height/width of the text inside (before applying any style of course):
For now I defined the 3 styles, but I'm not sure how to have access to the node's content (or why not directly to the height/width of the node's content).
MWE
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning}
\usetikzlibrary{shapes,shapes.geometric,shapes.misc}
\begin{document}
\tikzset{
nodeEmpty/.style={minimum width=.3mm, circle, fill=green},
nodeSmall/.style={minimum width=.3mm, circle, fill=green!70!black},
nodeLong/.style={minimum width=1cm, rounded rectangle, fill=green!50!black, inner xsep=3mm},
nodeAuto/.code={
%%% Goal: apply automatically the good style depending on the width of the text inside. Something like: if empty, apply nodeEmpty, if height is smaller than 2em and if ratio height/width > 0.5, apply nodeSmall, else apply nodeLong.
% ???
}
}
\begin{tikzpicture}
\node[nodeEmpty] at (0,0) {};
\node[nodeSmall] at (2,0) {$\frac{\pi}{2}$};
\node[nodeLong] at (4,0) {$a+b+c+d$};
\end{tikzpicture}
\end{document}

