I have a revision string automatically saved to a file VERSION (it is the output of git describe
and usually looks like v2.2-19-g0a51c27), and define a command
\newcommand*\fileversion{\input{VERSION}}
However, each time the command is used, the file is read once. So if I put the command on every page, VERSION will be read many times (= number of pages).
Currently I use savebox to avoid this problem but unfortunately this can not pick up the surrounding formatting style, for example, if surrounding text is in footnotesize, the savebox still uses normal size.
I also tried \edef\fileversion{\input{VERSION}}
but somehow TeX gave me 'stack limit' error.
So my question is how to define a command that expands to the contents of VERSION and not \input{VERSION}.
VERSION
file – Joseph Wright♦ Aug 14 '10 at 13:35git describe
. – Leo Liu Aug 14 '10 at 13:57