The cells in my tables often contain expressions with superscripts. This results in a text baseline that appears to "wander" between adjacent cells. For example
\begin{tikzpicture}[every node/.style={minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
produces

I understand that the way to align the text of all cells to a common baseline is to use anchor=base, but this has the side effect of jumbling the cells. For example
\begin{tikzpicture}[every node/.style={anchor=base,minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
produces

Is there a way to align all text to a common baseline, without shifting the cells as well?
\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.style={minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
\begin{tikzpicture}[every node/.style={anchor=base,minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
\end{document}

2ex? ;) – percusse Jun 26 '12 at 23:15emmainly because ratio betweenexandemare often the same regardless of the chosen font... – Paul Gaborit Jun 26 '12 at 23:39eminstead ofexwas given by Will himself: "I usually consider1emto be about the same size as the font size in points." ;-) – Paul Gaborit Jun 27 '12 at 00:01\matrix[every node/.style =...instead of\begin{tikzpicture}[every node/.style =.... – Alain Matthes Jun 27 '12 at 07:53