# Add when the file was compiled to the draft document.

I would like to have on my draft-documents on the bottom something like compiled ch2.tex on July 21, 2011 at 18:46. My document has multiple files which I include by using \input.

I have the following preamble (I only kept the relevant part):

\documentclass[a4paper,11pt, leqno, draft]{scrbook} %draft
\usepackage{scrtime}
\usepackage{currfile}
\usepackage{fancyref}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{calc}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancypagestyle{plain}{%
}
\lfoot{\scriptsize{\texttt{compiled \currfilename \ on \today \ at \thistime}}}
\cfoot{}
\rfoot{}

\author{Jonas Teuwen}
\title{}

\begin{document}

\input{ch1.tex}
\input{ch2.tex}

\end{document}


The line that gives problems is the following:

\lfoot{\scriptsize{\texttt{compiled \currfilename \ on \today \ at \thistime}}}


It does work, it gives me the correct result, however, at the last page of ch1.tex at the bottom LaTeX already prints the line for ch2.tex. What is wrong?

Another small question: How do I automatically disable this part if the document is set as [final] instead of [draft]?

-

You need to flush the last page of the chapter with \clearpage (or \newpage), otherwise LaTeX will already have opened file ch2.tex and \currfilename then holds that name.

Chapter should be included using \include which adds \clearpage automatically, not using \input. (You can also then use e.g. \includeonly{ch1} to only compile chapter 1.)

You can use the ifdraft package to only add this line only in draft mode:

\ifdraft{%
\lfoot{\scriptsize{\texttt{compiled \currfilename \ on \today \ at \thistime}}}%
}{}


Note that with the filemod package you can also add the file modification date.

-
Great! This is exactly what I wanted. –  Jonas Teuwen Jul 21 '11 at 18:03