[OS X TeX] Re: How to Add a watermark to a Tex document

John B. Thoo jthoo at yccd.edu
Thu Aug 16 21:53:23 EDT 2012


On Aug 16, 2012, at 12:00 PM, <macosx-tex-request at email.esm.psu.edu> wrote:

> Date: Thu, 16 Aug 2012 09:09:47 +1200
> From: Michael Welsh <yomcat at yomcat.geek.nz>
> 
> On 16/08/2012, at 9:05 AM, Byron Freelon <freelon at aps.anl.gov> wrote:
>> 
>> \usepackage{draftcopy}   does not seem to work.
> 
> This doesn't play nice with PDF.
> 
> Try draftwatermark instead.

Hi.  Try this with pdflatex.

------------------------------cut here---------------------------------
%% LaTeX filename vamosdraft.sty %%
%
%  Author: Peter Vamos <P.Vamos at exeter.ac.uk>
%          with contribution by
%          Claus Gerhardt <claus.gerhardt at uni-heidelberg.de>
%
%  To place a "DRAFT" watermark when using pdflatex.
%
%  This is the original code by Peter:
%
%%%%%%%%%%%%%%
%\usepackage{calc}
%\newcounter{hours}\newcounter{minutes}
%\newcommand\printtime{\setcounter{hours}{\time/60}%
%        \setcounter{minutes}{\time-\value{hours}*60}%
%        \thehours :\theminutes}
%%%%%%%%%%%%%%%%%%%%
%\usepackage[draft]{pdfdraftcopy}
%\draftstring{%
%\begin{minipage}{17cm}
%\begin{center}
%\  DRAFT \quad\today\ \printtime
%\end{center}
%\end{minipage}
%}
%
%  However, it would print the time, say 7:04, as 7:4, when I would
%  prefer the time to be printed as hh:mm.  To fix this, Claus Gerhardt
%  suggested this:
%
%\usepackage{ifthenelse}
%\newcounter{hours}\newcounter{minutes}
%\newcommand{\printtime}{%
%\setcounter{hours}{\time/60}%
%\setcounter{minutes}{\time-\value{hours}*60}%
%\ifthenelse{\value{minutes}<9}{\thehours :0\theminutes}{\thehours:\theminutes}}
%
%  But this would print the time, say 7:04, as 7:04, when would prefer
%  07:04.  Also, \usepackage{ifthenelse} had to be changed to
%  \usepackage{ifthen}.  Finally I edited the code to fix the time and to
%  print the date and time below the word "DRAFT" and in a smaller font.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\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}
}

%%%%%%%%%%%%%%%%%%%
\usepackage[draft]{pdfdraftcopy}
\draftstring{%
\begin{minipage}{17cm}
\begin{center}
  DRAFT  \\ {\fontsize{48}{17}\selectfont \today, \printtime}
\end{center}
\end{minipage}
}
------------------------------cut here---------------------------------


YMMV.

---John.

-----------------------------------------------------------------------
"Ten thousand difficulties do not make one doubt....  A man may be annoyed that he cannot work out a mathematical problem ... without doubting that it admits an answer."

---John Henry Newman [_Apologia_, p. 239 in Project Gutenberg's 
   <http://www.gutenberg.org/ebooks/22088>]





More information about the MacOSX-TeX mailing list