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
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
  \fancyhead{} % get rid of headers
  \renewcommand{\headrulewidth}{10pt} % and the line
\lfoot{\scriptsize{\texttt{compiled \currfilename \ on \today \ at \thistime}}}

\author{Jonas Teuwen}




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:

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

(See also Doing something only when the draft option is on?)

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

| improve this answer | |
  • Great! This is exactly what I wanted. – Jonas Teuwen Jul 21 '11 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.