# mercurial & LaTeX

Warning

This post is certainly obsolete...

1. Just a add the following lines to your Makefile

```HGID:=\$(shell hg parents -R .. --template "Mercurial revision {rev} - date: {date|isodate}")
hgid.tex:dummy
[ -f \$@ ] || touch \$@
echo '\\renewcommand{\hgid}{\$(HGID)}' > \$@
dummy: ;```
2. and this lines to your main tex file

```\newcommand{\hgid}{null}
\input{hgid}```

now one can use the command `\hgid` to get the version everywhere.

3. for instance

```\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\usepackage{fancyhdr}
\pagestyle{fancyplain}
\fancyhead{}
\chead{{\sc This a DRAFT, please do not distribute.}}
\cfoot{\HRule \\ \hgid}```