How does one restore the previous value of a PGF/TikZ key?
For example, I would like to set the inner sep of a matrix to 0em but set the inner sep of nodes within the matrix to be the value that existed just before the matrix was drawn. I thought that the following would work.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[every node/.style={draw}]
\pgfkeysgetvalue{/tikz/inner sep}{\previnnersep}
\matrix [matrix of nodes, inner sep=0em,
cells={inner sep=\previnnersep}] {
X & Y \\ };
\end{tikzpicture}
\end{document}
However, it produces output as if inner sep=0em were never included; this is certainly unexpected:

Even more startlingly, when I change the cells option to be cells={inner sep=1em} but leave the \pgfkeysgetvalue line included, the output is exactly as before --- the same as if inner sep=0.3333em were used everywhere!
This odd behavior seems to originate from the \pgfkeysgetvalue line because everything is as expected when I comment it out.
Why is this happening, and how can I achieve the desired behavior?

/pgfprefix:/pgf/inner xsepand/pgf/inner ysep. – Paul Gaborit Jun 21 '12 at 22:28/tikzprefix instead of/pgf, I get the error "Undefined control sequence.\pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@" However, since page 176 of the 2.10 manual says that/tikz/inner xsepis an alias for/pgf/inner xsep, I'm curious why it is necessary to use/pgffor this to work. – Henry DeYoung Jun 22 '12 at 00:59\pgfkeysgetvalue{/tikz/inner sep}{\previnnersep}not give some sort of error instead of the very odd behavior? Trying to use\pgfkeysgetvalue{/pgf/inner sep}{\previnnersep}does give an error, though. – Henry DeYoung Jun 22 '12 at 01:06/tikz/pgfis not actually an alias, it isn't defined. When you call it, pgfkeys passes unknown tikz keys on to pgf so it is effectively an alias. But getting its value uses a different mechanism to calling so it doesn't notice the alias. – Andrew Stacey Jun 22 '12 at 06:43