Can I use a command to set a variable, then use that variable earlier in the document?
Specifically, I want grab the last revision from the revision history table and put that in my footers.
In my *.tex, I have an environment and commands for a version-history table which I use like this:
\begin{history}
\version{1.0}{1 April 2020}{Initial Release}
\version{1.1}{10 Oct 2021}{Updated chapter 2}
\end{history}
In my *.cls I currently have:
\pagestyle{fancy} % Imports header style
\fancyhf{} % Clear header/footer
\fancyfoot[L]{\@title}
...
\newcommand{\version}[3]{#1 & #2 & #3\\\hline}
\newenvironment{history}{ ... }{ ... }
And I am thinking of doing this:
\def\@revision{?}
\pagestyle{fancy} % Imports header style
\fancyhf{} % Clear header/footer
\fancyfoot[L]{@title Rev@revision}
\newcommand{\version}[3]{%
\def@revision{#1}%
#1 & #2 & #3\\hline%
}
\newenvironment{history}{ ... }{ ... }
But there are two problems:
- My footers always show
?. - Even if
\@revisionwas updated, my version history table is not on the first page. So I imagine it would only set the value for later pages.
Is there a way I can store my revision in *.out or *.aux? Then my footer can use that value at the start of the document, and I'll get a rerunfilecheck if it changed since last run?
I found a promising answer here but it saves counters (which I assume are integer-only). I'm interested in something that can handle [a-zA-Z0-9\.]+