[OS X TeX] Package "draftwatermark" -- adding date-time stamp

Vamos, Peter P.Vamos at exeter.ac.uk
Tue Jan 29 14:19:44 EST 2013


Appended below is a tweaked code.  I changed minipage to \shortstack as suggested in the draftwatermark manual. This makes it easier to control the space between the lines. 
If you want the time stamp in addition to the date stamp then remove the comment % in the penultimate line. Note that the date stamp command \today is language dependent so if you are not American then uncomment %\usepackage[<language>]{babel} and %\selectlanguage{<language>} and replace <language> with yours, e.g. I am in the UK so I would use `british' for language. You can also change the options \SetWatermarkxxx to suit.

Background: the OP (John Thoo) raised this problem in 201, at that time the draftwatermark package didn't work with pdfLaTeX so I suggested the  pdfdraftcopy package and the usage with minipage to accommodate two lines. The code was later amended by Claus Gerhardt to allow leading zeros in the time stamp as John wanted; hence the use of the ifthen package. 

Recently John encountered some strange page breaks with the 2011 script but discovered that draftwatermark has been updated for pdfLaTeX and didn't exhibit this problem. (It turns out that he is also using the geometry package; loading this *after* the pdfdraftcopy package would also solve his problem, doesn't mess up the page breaks, something probably to do with \voffset.)

Peter

%%%%%%%%%%% draft watermark usage example %%%%%%%%%%
%%%%%%%%% print time %%%%%%%%%%%%
\usepackage{calc} 
\usepackage{ifthen} 
\newcounter{hours}\newcounter{minutes} 
\newcommand\printtime{% 
  \setcounter{hours}{\time/60}% 
  \setcounter{minutes}{\time-\value{hours}*60}% 
  \ifthenelse{\value{hours}<10}{0\thehours}{\thehours}:\hspace{-0.33em} 
  \ifthenelse{\value{minutes}<10}{0\theminutes}{\theminutes} 
} 

%%%%%%%%%%% watermark %%%%%%%% 
%\usepackage[<language>]{babel}
\usepackage{draftwatermark}
\SetWatermarkScale{2}
\SetWatermarkLightness{0.8}
\SetWatermarkText{\shortstack{DRAFT  \\[0.5cm] {\fontsize{38}{12}\selectfont 
%\selectlanguage{<language>}
\today}%, \printtime
}}
%%%%%%%%%%%%%%%%%%%%%%


More information about the MacOSX-TeX mailing list