I want to save the value of a particular key (from pgfkeys) into the aux file for my LaTeX document. If it matters, I'm using LuaLaTeX, but the same problem is exhibited by XeLaTeX, pdfLaTeX, and the original LaTeX (producing dvi -> ps -> pdf).
Here is a minimal (non-)working example:
\documentclass{standalone}
\usepackage{pgfkeys}
\pgfkeys{/test key/.initial=0}
\begin{document}
\pgfkeysvalueof{/test key}
\makeatletter\protected@write\@auxout{}{\protect\pgfkeys{/test key=2}}\makeatother
\pgfkeysvalueof{/test key}
\end{document}
The resulting aux file shows that the write was successful:
\relax
\pgfkeys {/test key=2}
However, no matter how many times I run (Lua|Xe|pdf|)LaTeX, the displayed values are "0" and "0"; I am trying to make them (after at least two runs) display "2" and "2".
How can I get my intended results? I would really like to stick with pgfkeys if at all possible; am I just going about this the wrong way?
