# How to “fix baselines” in tikz nodes?

I want to define nodes which are shapes with some text in it using \ce{} from the mhchem package. How would I go around ensuring the baselines are the same between nodes, right now it shifts if I use subscript. Here's a MWE:

\documentclass{article}
\usepackage[version=3]{mhchem}

\usepackage{tikz}
\usetikzlibrary{shapes}

\newbox\nodebox
\newcommand\mycommand[2]{%
\begin{tikzpicture}%
\node[text=#1, rectangle, inner ysep=4pt, inner xsep=2pt, rounded corners=7, minimum height=5mm, minimum width=10mm, fill=#1] {\tiny\sffamily \textbf{\ce{#2}}};
\node[yshift=-0.5,text=black!95!white] {\scriptsize\sffamily \textbf{\ce{#2}}};
\node[text=white] {\scriptsize\sffamily \textbf{\ce{#2}}};
\end{tikzpicture}%
}

\begin{document}

\mycommand{red!40!white}{Al2O3} \mycommand{blue!40!white}{Al}

\end{document}

-

In this case, you need to manually set the text depth of all nodes to the same value. If you set it to text depth=0pt, the text will be aligned as if there were no descenders or subscripts, if you set it to something like text depth=0.25ex, the text in all nodes will be aligned as if there were.

\documentclass{article}
\usepackage[version=3]{mhchem}

\usepackage{tikz}
\usetikzlibrary{shapes}

\newbox\nodebox
\newcommand\mycommand[2]{%
\begin{tikzpicture}[every node/.append style={text depth=0.25ex}]%
\node[
text=#1,
rectangle,
inner ysep=4pt,
inner xsep=2pt,
rounded corners=7,
minimum height=5mm,
minimum width=10mm,
fill=#1
] {\tiny\sffamily \textbf{\ce{#2}}};
\node[
yshift=-0.5,
text=black!95!white
] {\scriptsize\sffamily \textbf{\ce{#2}}};
\node[text=white]{\scriptsize\sffamily\textbf{\ce{#2}}};
\end{tikzpicture}%
}

\begin{document}

\mycommand{red!40!white}{Al2O3} \mycommand{blue!40!white}{Al}

\end{document}

-