# Include source filename in footer with SVN Info

I use a set of LaTeX templates (.tex files) to generate several documents (letters, reports, invoices etc.). All my source files are version controlled in Tortoise SVN but the resulting pdf output files are not.

I am looking for an option where when i compile a certain .tex file, the filename is printed in the .pdf output somewhere (header, footer) etc. How can i pass this argument within the source code to include the name?

For ex.: I have

• template1 which generates letter1, letter2
• template2 which generates letter3, letter4

Since the templates are in SVN, i normally delete the compiled docs after i have used them. When I want to repeat the process, let's say after a few months, I have to go through the SVN logs and source codes to see which one I had used.

Instead it would be great if i could see in one of the compiled docs and know the corresponding template used. Any help will be appreciated :)

Here is my code:

\documentclass[
a4paper,
fromalign = right,
foldmarks = true,
enlargefirstpage=true,
]{scrlttr2}

\usepackage{svn-multi}
\svnidlong
{$HeadURL:$}
{$LastChangedDate:$}
{$LastChangedRevision:$}
{$LastChangedBy:$}
\svnid{$Id:$}

\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{url}
\usepackage{graphicx}
\renewcommand*{\raggedsignature}{\raggedright}
\setlength{\parindent}{0pt}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[ol]{\jobname}
\fancyfoot[or]{Rev:\svnrev \ (\svnfilerev)}

\begin{document}
Timbaktu
}

\setkomavar{subject}{Include footer in a letter}

\opening{Dear fellow TeXnician}

I am trying to include the footer in the letter template but unable to do so. Furthermore, I would like to integrate some SVN features into this. This works on other pages and other documents except on the opening page of the letter.

If you solve my problem, the next beer is on me!

\closing{Yours Sincerely,}
\end{letter}
\end{document}

• Have a look at this article from the PracTeX journal: tug.org/pracjourn/2007-3/scharrer, you might need to have Tortoise also add the command line svn tools as well, as some of the features in the article might not have an interface in the Tortoise menus. I use this feature in some of my own works and it works pretty good. – daleif Aug 14 '17 at 11:00
• Thanks! just glanced through it and found an example which points in the direction I am looking for. Still have to try it out – elprofessor Aug 14 '17 at 11:45
• Add \jobname somewhere ? – Fran Aug 14 '17 at 11:49
• @Fran....yes! that works too. That was simple, thanks a lot:) – elprofessor Aug 14 '17 at 11:56
• You're using svn-multi so you can easily produce svn information in the header, footer or anywhere else you like. E.g. I use \svnkw{HeadURL} and other information in drafts. Or do you mean that you want the name of a class or package to appear in the document ('template' isn't clearly defined)? In that case, consider using svn-prov and then you can easily access the class/package subverion info. – cfr Aug 15 '17 at 21:59

You just need to force the page style for the current page. Alternatively, consider using KOMA-facilities for your footers, which will probably be cleaner and smoother.

\documentclass[
a4paper,
fromalign = right,
foldmarks = true,
enlargefirstpage=true,
]{scrlttr2}

\usepackage{svn-multi}
\svnidlong
{$HeadURL:$}
{$LastChangedDate:$}
{$LastChangedRevision:$}
{$LastChangedBy:$}
\svnid{$Id:$}

\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{url}
\usepackage{graphicx}
\renewcommand*{\raggedsignature}{\raggedright}
\setlength{\parindent}{0pt}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[ol]{\jobname}
\fancyfoot[or]{Rev:\svnrev \ (\svnfilerev)}

\begin{document}
Timbaktu
}

\setkomavar{subject}{Include footer in a letter}

\opening{Dear fellow TeXnician}

I am trying to include the footer in the letter template but unable to do so. Furthermore, I would like to integrate some SVN features into this. This works on other pages and other documents except on the opening page of the letter.

If you solve my problem, the next beer is on me!

\closing{Yours Sincerely,}
\end{letter}
\end{document}


Obviously, the actual output isn't very informative because there is no actual version information in the file and the \jobname probably means little to you.